In react native, FlatList is calling the onEndReached function on the initial load and not calling it when reaching the end of the list.
I tried doing everything, from changing the threshold to adding a container with flex: 1;
. But it’s not working :/
The problem is that, I have ScrollView in parent (ScrollView is nesting the FlatList). This is the main problem, I also tried setting nestedScrollEnabled
. But still not working.
Here’s my FlatList component:
<FlatList
data={stationComments}
keyExtractor={(_, index) => index.toString()}
renderItem={({ item: comment }) =>
<Review
key={comment.commentId}
comment={comment}
/>
}
onEndReached={() => nextPage()}
onEndReachedThreshold={0}
/>
Thanks!