cmcodes
cmcodes

Reputation: 1866

Implementing sticky headers inside a FlatList in React Native

I tried to implement sticky headers inside a FlatList and encountered the following error: undefined is not an object (evaluating '_this3.state.stickyHeaderIndices')

Code Link (Snack): https://snack.expo.io/@cmcodes/forlorn-cake

Upvotes: 0

Views: 5740

Answers (1)

Vivek Verma
Vivek Verma

Reputation: 551

This error is due to the fact that this is limited to use in your Explore Screen class, since you are using functional component to render list, you have to pass the sticky header data as you have passed the data i.e via props.

You can check the updated code at

https://snack.expo.io/1JtMGGDd4

Upvotes: 1

Related Questions