React-Native视图使用显式设置的宽度/高度渲染,但使用0 flexBasi
发布时间:2020-12-15 20:51:23 所属栏目:百科 来源:网络整理
导读:在React-native 0.39, 我经常得到这个错误,但我不太明白为什么(指出我没有设置flexGrow的事实). 这是控制台的错误 View was rendered with explicitly set width/height but with a 0 flexBasis. (This might be fixed by changing flex: to flexGrow:) View
在React-native 0.39,
我经常得到这个错误,但我不太明白为什么(指出我没有设置flexGrow的事实). 这是控制台的错误 View was rendered with explicitly set width/height but with a 0 flexBasis. (This might be fixed by changing flex: to flexGrow:) View: <RCTShadowView: 0x6080005a02a0; viewName: RCTView; reactTag: 2608; frame: {{0,0},{nan,nan}}> 有人可以向我解释为什么这个错误被触发? 编辑:错误来自我在主视图中添加的这个样板代码: flex: 1,// remove width and height to override fixed static size width: null,height: null, 但是,如果有人能够反思自己的样式,或者导致我获得良好的资源,我将不胜感激:)
参考
react-native/React/Views/RCTShadowView.m,有评论
This works around a breaking change in css-layout where setting flexBasis needs to be set explicitly,instead of relying on flex to propagate. We check for it by seeing if a width/height is provided along with a flexBasis of 0 and the width/height is laid out as 0. 当flex没有定义的flexBasis并且width或height为零时,会触发错误. 参考react-native/Libraries/StyleSheet/LayoutPropTypes.js,我们知道flexGrow,flexShrink和flexBasis接收的数字值. 有关可视化指南,请参阅此网页A Visual Guide to CSS3 Flexbox Properties. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- flex在DataGrid中添加checkbox复选框,并获取选中的值
- xcode – 如何在Swift中使用Alamofire上传使用参数的图像
- Mapper的XML配置文件之properties
- NoSQL数据库的出现及选择哪种NoSQL数据库
- c# – 使用DataTable在DataGrid中使用WPF单个单元格颜色
- OSX中内存分配缓慢
- c# – 用于快速属性分配的Visual Studio Shortcu /语法
- 使用ADAL C#作为机密用户/守护程序服务器/服务器到服务器 –
- uboot-2010.06移植到mini2440经验(3)添加nor flash支持
- postgresql – 在postgres中对jonined查询返回0计数