Jacse / react-native-app-intro-slider

Simple and configurable app introduction slider for react native
MIT License
1.65k stars 330 forks source link

Failed child context type: Invalid child context `virtualizedCell.cellKey` of type `number` supplied to `CellRenderer`, expected `string`. #232

Open Lekhrajk opened 3 years ago

Lekhrajk commented 3 years ago

I am getting this warning again and again How to remove this warning

barinascode commented 3 years ago

x2

JoeToeniskoetter commented 3 years ago

I am getting this warning again and again How to remove this warning

Found a solution. Just pass your own keyExtractor function to the <AppIntroSlider/> component and cast to string. FlatList requires a string key.

return (
    <AppIntroSlider
      keyExtractor={(item) => item.id.toString()}
      renderItem={_renderItem}
      data={steps}
      onDone={_onDone}
      renderNextButton={_renderNextButton}
      renderDoneButton={_renderDoneButton}
    />
  )
Sanan4li commented 3 years ago

This results in TypeError: undefined is not an object (evaluating 'item.id.toString')

Sanan4li commented 3 years ago

The following worked for me keyExtractor={(item, index) => index.toString()} just pass it to your AppIntroSliderComponent

phamhieu1412 commented 2 years ago

I am getting this warning again and again How to remove this warning

Found a solution. Just pass your own keyExtractor function to the <AppIntroSlider/> component and cast to string. FlatList requires a string key.

return (
    <AppIntroSlider
      keyExtractor={(item) => item.id.toString()}
      renderItem={_renderItem}
      data={steps}
      onDone={_onDone}
      renderNextButton={_renderNextButton}
      renderDoneButton={_renderDoneButton}
    />
  )

work for me. keyExtractor={(item) => ${item.key}} or keyExtractor={(item) => ${item.id}} with key(id) from a element of data slide