首页 > 解决方案 > iOS 中的 React Native 60 及以上边距问题 - 忽略虚假层大小

问题描述

我在较旧的 react native 项目中使用了边距样式,这没有问题。现在我正在创建新的 RN 项目 - 0.60.5 版本。

return(
        <ImageBackground
        style={{ flex: 1, alignItems: "center", justifyContent: "center" }}
        source={require('../images/bgImage.png')}
      >
         <View style={{backgroundColor:"white",height:"8%",
         borderRadius:5,width:"70%",marginTop:10}}>

         </View>

      </ImageBackground>
    )

在上面的代码中,添加marginTop组件ViewiOS 应用程序后挂起并将日志显示为

Ignoring bogus layer size (179769313), contentsScale 1.000000, backing store size

如果我删除marginTopstyle ,那么 UI 将被渲染。

有没有人在 React Native iOS 中知道它?如何解决这个问题?

标签: iosreact-native

解决方案


我有同样的问题。将 Xcode 升级到 v11.2.1 修复了它。


推荐阅读