Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I updgraded from react 16.2 -> 16.3-alpha-1 and react-native 0.52->0.54 and I get the warning above in the simulator.

like image 565
dhj Avatar asked Mar 30 '18 16:03

dhj


1 Answers

To fix the error in any list components where a keyExtractor is in use, update the Component (FlatList etc) to have a string key with .toString(). All keys must now be string values.

Like below;

keyExtractor={item => item.index_id} 

to

keyExtractor={item => item.index_id.toString()} 

This change is a requirement for all uses of a keyExtractor so that would include React-Native components like; FlatList and ActionSheet.

like image 68
dhj Avatar answered Oct 14 '22 04:10

dhj