一、错误日志:Warning: Failed child context type: Invalid child context virtualizedCell.cellKey of type number supplied to CellRenderer, expected string.
这个错误是在使用 RN官网推出最新的列表组件 FlatList 是出现的红色警告,出现这个错误可以正常运行,就是每次调试时看到它总觉得怪怪的,所以就查资料处理了,下面给出解决方案:

解决示例代码片段:

<FlatList
style={myStyle.newsList}
ref={(flatList)=>this._flatList = flatList}
ItemSeparatorComponent={this._separator}
renderItem={this._renderItem}
keyExtractor={(item, index) => index.toString()}
data={data}>
</FlatList>

相关文章:

  • 2021-05-02
  • 2021-04-19
  • 2021-05-14
  • 2021-12-25
  • 2022-12-23
  • 2022-02-13
  • 2022-12-23
  • 2021-08-08
猜你喜欢
  • 2022-12-23
  • 2021-11-09
  • 2022-01-20
  • 2021-07-27
  • 2022-12-23
  • 2021-06-06
  • 2021-08-06
相关资源
相似解决方案