RN常见报错信息
2017-09-14 本文已影响46人
戒惜舍得
RawText " " must be wrapped in an explicit <Text> component.
原因:
render
和他调用方法里面有空格没有放在Text
控件中,开发的时候,中文空格经常输入。
Warning: Each child in an array or iterator should have a unique "key" prop.
Check the render method ofVirtualizedList
.
上面这个flatList
常见报错。
原因:
keyExtractor={item => item.userId}
这里需要注意的是 item
后面的属性一定要是每一个row 都有的并且不一样的值。
"Warning: setState(...): Can only update a mounted or mounting component.
这里我打开模拟器,看有Stacktrace
打开是指向这局代码:
this.setState({count: ++count});