I have 3 ListView
components inside a single ScrollView
component like this:
<ScrollView>
<Header />
<ListView onEndReached={() => alert('load more 1')}/>
<ListView onEndReached={() => alert('load more 2')}/>
<ListView onEndReached={() => alert('load more 3')}/>
<Footer />
</ScrollView>
The Header
component has some common content and also has 3 tabs, which trigger showing the respective ListView
The issue is any ListView
with onEndReached={() => alert('load more 1')}
never runs the alert, so I can never load more as I scroll down and hit the end of the listview. Remove the wrapping ScrollView
and the alert runs, but the common Header
doesn't scroll, since we just removed the wrapping ScrollView
. The header needs to scroll with the listview, which is why I wrapped everything that needs to scroll in the ScrollView
.
IMPORTANT NOTE:
I can't really use ListView
with renderHeader={this.header}
, for this scenario. Because, even though the Header
will scroll, it will rerender the common Header
and the 3 tabs for each ListView
each time a ListView
renders, instead of once. So a new Header
rerender each time for each ListView
won't cut it for the app.
Looking for a solution to this problem, where the Header
scrolls with the listviews and the onEndReached
is triggered for the visible ListView
.