神坑react native之Cannot Add a child that doesn’t have a YogaNode to a parent with out a measure function

在react native最新版 0.50,遍历数据时在组件标签中插入数据,写法大致如下:

...<View style={[styles.flitem,{}]}>{item.key}</View>...

会报错:

Cannot Add a child that doesn't have a YogaNode to a parent with out a measure function

react native的一贯作风,凡是升级,必定整点幺蛾子(但升级也别太频繁了好不好~~~手动哭脸)

react native在国内刚火起来,没那么多资料可以查,百度就别指望了。搭梯子去谷歌,搜到了这里:https://github.com/facebook/react-native/issues/13243,里面网友parthgandhi7说的靠谱。解决方法是将变量放到Text组件中:

...<View style={[styles.flitem,{}]}><Text>{item.key}</Text></View>...
关于博主
骨灰级博客玩家
国内第一批90后网站站长/程序员
做过七年前端讲师
目前从事锦鲤观赏鱼电商行业
鱼贝贝锦鲤创始人
文章列表
1
hbuilder编辑器无法自动编译less文件的终极解决方案之koala考拉解析器
hbuilder编辑器无法自动编译less文件的终极解决方案之koala考拉解析器
2
掰扯掰扯npm、cnpm和yarn
掰扯掰扯npm、cnpm和yarn
3
windows下快速删除大量文件的方法
windows下快速删除大量文件的方法
4
谷歌浏览器黄色警告Fetching scripts with an invalid type/language attributes is deprecated and will be removed in M56...的解决方案
谷歌浏览器黄色警告Fetching scripts with an invalid type/language attributes is deprecated and will be removed in M56...的解决方案
5
被Windows BitLocker加密后的磁盘或设备,取消加密会丢失数据吗?
被Windows BitLocker加密后的磁盘或设备,取消加密会丢失数据吗?
最新评论
比比拉布
比比拉布
5月7日
太感谢了!!!!!!找了这么多的教程,只有你点出来了关键点——设计视图!!!!
Jake
Jake
3月7日
Halo 啊~麻烦更新下我的博客地址,原名:Jing Blog。麻烦更新如下: Jake Blog(后缀可以省略,也可以保留,看哪个风格适合) 网址:htt
评论于关于博主