question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

Please make our job easier by filling this template out to completion. If you’re requesting a feature instead of reporting a bug, please feel free to skip the Environment and Reproducible Demo sections.

Description

Since I upgraded from react-native 0.51 to 0.53, I get this warning in the Adenda: Warning : Failed child context type: Invalid child context ‘virtualizedCell.cellKey’ of type ‘number’ supplied to ‘CellRenderer’, expected ‘string’

Expected Behavior

What action did you perform, and what did you expect to happen? I upgraded from react-native 0.51 to 0.53

Observed Behavior

What actually happened when you performed the above actions? the warning is poping.

If there’s an error message, please paste the full terminal output and error message in this code block: No error, just a warning…

Warning: Failed child context type: Invalid child context virtualizedCell.cellKey of type number supplied to CellRenderer, expected string. in CellRenderer (at VirtualizedList.js:681) in RCTView (at View.js:71) in View (at ScrollView.js:726) in RCTScrollView (at ScrollView.js:820) in ScrollView (at VirtualizedList.js:1009) in VirtualizedList (at FlatList.js:640) in FlatList (at index.js:188) in ReactComp (at index.js:267) in RCTView (at View.js:71) in View (at index.js:375) in RCTView (at View.js:71) in View (at index.js:374) in AgendaView (at Calendar.js:96) in Calendar (created by Connect(Calendar)) in Connect(Calendar) (at Navigation.js:83) in Provider (at Navigation.js:82) in _class2 (at renderApplication.js:35) in RCTView (at View.js:71) in View (at AppContainer.js:102) in RCTView (at View.js:71) in View (at AppContainer.js:122) in AppContainer (at renderApplication.js:34)

Environment

Please run these commands in the project folder and fill in their results:

  • npm ls react-native-calendars: `-- react-native-calendars@1.17.1
  • npm ls react-native: `-- react-native@0.53

Also specify:

  1. Phone/emulator/simulator & version:

This is hapenning for both iOS and Android. It seems that react-native is now expecting String keys in ListViews, but not sure how to address this issue.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:8
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

20reactions
donni106commented, Mar 13, 2018

Thx @anti-nerd, this helped me out.

Changed keyExtractor = (item) => item.id; to keyExtractor = (item) => `key-${item.id}`; and the warning disappeared.

14reactions
crim3houndcommented, Mar 11, 2018

Facing a similar issue in RN 0.54.1.

UPDATE: Just fixed the issue by converting the result from my key extractor to a string using the toString() method as follows: _keyExtractor = (item, index) => index.toString();. I hope this helps someone else.

cc: @sylvainbouxin @hardy-android @chrismllr

Read more comments on GitHub >

github_iconTop Results From Across the Web

Invalid child context 'virtualizedCell.cellKey' of type 'number ...
To fix the error in any list components where a keyExtractor is in use, update the Component (FlatList etc) to have a string...
Read more >
Invalid child context `virtualizedCell.cellKey` of type `number ...
Warning : Failed child context type: Invalid child context virtualizedCell.cellKey of type number supplied to CellRenderer , expected string ...
Read more >
Invalid child context `virtualizedCell.cellKey` of type `number`
Warning : Failed child context type: Invalid child context `virtualizedCell.cellKey` of type `number` supplied to `CellRenderer`, expected `string`.
Read more >
Invalid child context 'virtualizedCell.cellKey' of type 'number ...
Warning : Failed child context type: Invalid child context ... cellKey' of type 'number' supplied to 'CellRenderer', expected 'string'.
Read more >
Invalid child context 'virtualizedCell.cellKey' of type - YouTube
iOS : Warning : Failed child context type : Invalid child context ... of type ' number ' supplied to ' CellRenderer ',...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found