神坑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
Adobe premiere 替换素材后无法显示,显示斜线波纹的解决方法
Adobe premiere 替换素材后无法显示,显示斜线波纹的解决方法
2
一点随感
一点随感
3
老孙谈“师德”-最近一些热点事件引发的思考
老孙谈“师德”-最近一些热点事件引发的思考
4
只有程序员才有的神逻辑
只有程序员才有的神逻辑
5
神坑react native之ScrollView child layout (["alignitems", "justifyContent"]) must be applied through the contentContainerStyle prop
神坑react native之ScrollView child layout (["alignitems", "justifyContent"]) must be applied through the contentContainerStyle prop
最新评论
比比拉布
比比拉布
5月7日
太感谢了!!!!!!找了这么多的教程,只有你点出来了关键点——设计视图!!!!
Jake
Jake
3月7日
Halo 啊~麻烦更新下我的博客地址,原名:Jing Blog。麻烦更新如下: Jake Blog(后缀可以省略,也可以保留,看哪个风格适合) 网址:htt
评论于关于博主