关于react native 报 Cannot add a ch

2018-08-21  本文已影响46人  tomorrow_chen

Cannot add a child that doesn't have a YogaNodeto a parent without a measure function! (Tryingto add a 'ReactRaw TextShadowNode' to a'LayoutShadowNode') addChildAt

Screenshot_2018-08-16-18-23-04-794_com.ylxapp.png

经查找发现:

{
  transferCity &&
    <View style={styles.icon}><Text style={{ color: '#fff' }}>转</Text></View>
}

上面的写法引起的, ios这么写没问题, 安卓却报错了, 改成下面的写法就好了

{
  transferCity ?
    <View style={styles.icon}><Text style={{ color: '#fff' }}>转</Text></View> : null
}
上一篇 下一篇

猜你喜欢

热点阅读