【问题标题】:React-Native SafeAreaView causes weird gap on screen (Ios)React-Native SafeAreaView 导致屏幕上出现奇怪的间隙(Ios)
【发布时间】:2022-07-07 20:50:11
【问题描述】:

See this screen-short` “反应原生”:“0.67.4”, "react-native-safe-area-context": "^4.2.2",

我在 ios 上遇到了奇怪的问题。每当我第一次访问此屏幕时,底部都会出现空白屏幕。 但是导航另一个屏幕,它会自行消失。 `

https://reactnavigation.org/docs/handling-safe-area/#use-the-edges-prop-to-customize-the-safe-area

我已经看过他们的 react-navigation 文档了。

【问题讨论】:

    标签: reactjs react-native


    【解决方案1】:

    我也面临同样的问题。帮助我的是使用来自react-native-safe-area-context 的useSafeAreaInsets 和普通的<View/> 而不是<SafeAreaView/>

        const insets = useSafeAreaInsets();
        
        return (
            <View
              style={{
                  paddingTop: insets.top,
                  paddingLeft: insets.left,
                  paddingRight: insets.right,
                }}
            >
              {...}
            </View>
        )
    
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-27
      相关资源
      最近更新 更多