神坑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>...
评论
还没有评论
    发表评论 说点什么