首页 > 其他 > 详细

React-Native 遇到的坑

时间:2019-10-11 13:05:42      阅读:82      评论:0      收藏:0      [点我收藏+]

一、错误日志: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>

React-Native 遇到的坑

原文:https://www.cnblogs.com/dtdxrk/p/11652975.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!