Warning : Failed child context type: Invalid child context ‘virtualizedCell.cellKey’ of type ‘number’ supplied to ‘CellRenderer’, expected ‘string’

react native 开发中 使用组件 FlatList是出现如下警告:

Warning: Failed child context type: Invalid child context `virtualizedCell.cellKey` of type `number` supplied to `CellRenderer`, expected `string`.
    in CellRenderer (created by VirtualizedList)
    in RCTScrollContentView (created by ScrollView)
    in RCTScrollView (created by ScrollView)
    in ScrollView (created by VirtualizedList)
    in VirtualizedList (created by FlatList)

解决方法:

keyExtractor = (item, index) => index.toString();

keyExtractor 必须的值必须为字符串