勤做笔记,方便自己,帮助他人。
Cannot add a child that doesn't have a YogaNode to a parent without a measure function! (Trying to add a 'ReactRawTextShadowNode' to a 'LayoutShadowNode') addChildAt ReactShadowNodeImpl.java:199 addChildAt ReactShadowNodeImpl.java:54 setChildren
错误1
废话不多说 旧代码
{
data.face&&
<TouchableOpacity onPress={()=>this.delImg('face')} style={styles.delImg}>
<Image source={require('../../images/shanchu.png')} />
</TouchableOpacity>
}
废话不多说 新代码
{
data.face?
<TouchableOpacity onPress={()=>this.delImg('face')} style={styles.delImg}>
<Image source={require('../../images/shanchu.png')} />
</TouchableOpacity>
:null
}
错误2
该错误一般是因为render方法中注释语句写法不正确,render的return函数里面的注释语句应该写在 {} 里面,而不是直接 //,正确写法:{/*注释语句 */}
最全的解释:https://github.com/facebook/react-native/issues/13243#issuecomment-335488473
网友评论