美文网首页
关于react native 报 Cannot add a ch

关于react native 报 Cannot add a ch

作者: tomorrow_chen | 来源:发表于2018-08-21 15:09 被阅读46次

    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
    }
    

    相关文章

      网友评论

          本文标题:关于react native 报 Cannot add a ch

          本文链接:https://www.haomeiwen.com/subject/wmcjiftx.html