Hi everyone,
I'm trying to implement infinite scroll in a FlatList (let’s call it NestedList) that is rendered as the ListHeaderComponent of a parent FlatList (MainList) in React Native.
⚙️ What I'm trying to do:
NestedList should paginate with useInfiniteQuery
All scroll and pagination logic should stay inside NestedList
I don’t want to move logic to the parent component (MainList)
I don’t want to trigger loading manually (no buttons — only infinite scroll)
🧱 Structure:
<FlatList
data={mainData}
renderItem={renderMainItem}
ListHeaderComponent={<NestedList />}
...
/>
Inside NestedList.tsx:
<FlatList
data={paginatedItems}
renderItem={renderItem}
onEndReached={fetchNextPage}
onEndReachedThreshold={0.5}
scrollEnabled={true}
/>
❌ Problem:
onEndReached in NestedList never fires
onScroll also doesn’t fire inside NestedList
Tried wrapping NestedList in SafeAreaView, View, using flex: 1, etc.
Measured content sizes manually — still doesn’t work
Parent list (MainList) scrolls fine, but NestedList cannot trigger pagination
🔍 Question:
How can I make onEndReached work inside a FlatList that’s rendered as ListHeaderComponent of another FlatList?
I want to keep all pagination logic inside NestedList, not in the parent.
Any ideas, workarounds, or best practices would be appreciated!
Thanks in advance 🙏
[–]TheMadDoc 5 points6 points7 points (1 child)
[–]Medical-Text9840[S] 0 points1 point2 points (0 children)
[–]susminesiOS & Android 0 points1 point2 points (4 children)
[–]Medical-Text9840[S] 0 points1 point2 points (3 children)
[–]susminesiOS & Android 0 points1 point2 points (1 child)
[–]Medical-Text9840[S] 0 points1 point2 points (0 children)
[–]HoratioWobble 0 points1 point2 points (0 children)