You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FlatList can enter a state where onEndReached gets called in a loop if I use the onEndReached prop to fetch the next page of the data and this causes a change in the height of ListFooterComponent (see attached screen recording).
Adding a fixed footer height in ListFooterComponentStyle to the component fixes the issue, however this isn't optimal as we would like to display different types of content depending on the state of the data.
Run the app on either iOS or Android (bug seems to be worse on Android)
Scroll to the bottom of the list - you should notice the footer changing multiple times between loading and finished state. You will also notice multiple logs being fired from the onEndReached function as it gets called again and again.
Description
FlatList can enter a state where
onEndReached
gets called in a loop if I use theonEndReached
prop to fetch the next page of the data and this causes a change in the height ofListFooterComponent
(see attached screen recording).Adding a fixed footer height in
ListFooterComponentStyle
to the component fixes the issue, however this isn't optimal as we would like to display different types of content depending on the state of the data.Example code:
Steps to reproduce
onEndReached
function as it gets called again and again.React Native Version
0.76.5
Affected Platforms
Runtime - Android, Runtime - iOS
Output of
npx react-native info
Stacktrace or Logs
Reproducer
https://github.com/KristineTrona/flatlist-onEndReached-called-in-loop
Screenshots and Videos
Bug:
Screen.Recording.2024-12-13.at.17.16.39.mov
With fixed height:
Screen.Recording.2024-12-13.at.17.32.33.mov
The text was updated successfully, but these errors were encountered: