神坑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
Windows11系统cmd终端提示“命令提示符已被系统管理员停用”的一种可行解决方案
Windows11系统cmd终端提示“命令提示符已被系统管理员停用”的一种可行解决方案
2
神奇的PS!Photoshop傻瓜化智能一键去水印教程
神奇的PS!Photoshop傻瓜化智能一键去水印教程
3
我是前端,我TM上辈子欠你们的了?!
我是前端,我TM上辈子欠你们的了?!
4
安装草图大师(sketchup)时提示“模块C:\Program Files\SketchUp\SketchUp 2018\ThumbsUp.dll注册失败。请与您的支持人员联系”错误的解决方法
安装草图大师(sketchup)时提示“模块C:\Program Files\SketchUp\SketchUp 2018\ThumbsUp.dll注册失败。请与您的支持人员联系”错误的解决方法
5
vue报错[Vue warn]: Unknown custom element: <mycom1> - did you register the component correctly? For recursive components, make sure to provide the "name" option.的解决方法
vue报错[Vue warn]: Unknown custom element: <mycom1> - did you register the component correctly? For recursive components, make sure to provide the "name" option.的解决方法
最新评论
比比拉布
比比拉布
5月7日
太感谢了!!!!!!找了这么多的教程,只有你点出来了关键点——设计视图!!!!
Jake
Jake
3月7日
Halo 啊~麻烦更新下我的博客地址,原名:Jing Blog。麻烦更新如下: Jake Blog(后缀可以省略,也可以保留,看哪个风格适合) 网址:htt
评论于关于博主