【问题标题】:how can I get the background to cover the screen. in React Native我怎样才能让背景覆盖屏幕。在 React Native 中
【发布时间】:2021-10-10 03:55:26
【问题描述】:

const styles = StyleSheet.create({
    container: {
        flex: 1,
        alignItems: 'center',
        justifyContent: 'center',
        height:"100%",
        width:"100%"
      },
});

export default styles;

【问题讨论】:

  • 您可能在容器外使用安全区域视图,只需将其移动到容器内,即背景视图内

标签: reactjs typescript react-native


【解决方案1】:
<View style={styles.container}>
     <SafeAreaView>
     {... rest of the code}
     </SafeAreaView>
    </View>

如果您没有在主代码中使用它,则它必须在 app.js 或您将导航包装在其中的任何文件中。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-08-12
    • 2012-10-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-11
    相关资源
    最近更新 更多