Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onEndReached called on initial render #937

Closed
Samide47 opened this issue Oct 23, 2023 · 11 comments
Closed

onEndReached called on initial render #937

Samide47 opened this issue Oct 23, 2023 · 11 comments
Labels
bug Something isn't working

Comments

@Samide47
Copy link

Current behavior

<FlashList
data={products}
keyExtractor={(item) => item._id}
estimatedItemSize={200}
numColumns={2}
showsVerticalScrollIndicator={false}
renderItem={(item) => (

)}
ListEmptyComponent={}
onEndReached={() => {
console.log("on end reach");
handleStartLoadingMore() && loadMore();
}}
onEndReachedThreshold={0.25}
ListFooterComponent={isLoading && loading more...}
/>

Platform:

  • [ x] iOS
  • [ x] Android

Environment

"@shopify/flash-list": "^1.6.2",
"react": "18.2.0",
"react-native": "0.72.5",

@Samide47 Samide47 added the bug Something isn't working label Oct 23, 2023
@elencho
Copy link

elencho commented Nov 1, 2023

+1

3 similar comments
@jianxinzhoutiti
Copy link

+1

@derrysukrie
Copy link

+1

@csillaj
Copy link

csillaj commented Jan 26, 2024

+1

@zavbala
Copy link

zavbala commented Feb 9, 2024

Yeah, run twice

@LabLamb
Copy link

LabLamb commented Mar 2, 2024

Mine ran non-stop

@naqvitalha
Copy link
Collaborator

If the content doesn't fill the screen on initial render then the callback will fire. If it's being called incorrectly then most like the estimatedItemSize value is incorrect.

@natemartins
Copy link

If the content doesn't fill the screen on initial render then the callback will fire. If it's being called incorrectly then most like the estimatedItemSize value is incorrect.

This issue persists. In my case, the content fills the screen on initial render. Note that I have a list over 30 items.

@purplereborn
Copy link

const [onEnd, setOnEnd] = useState<boolean>(true);

onMomentumScrollBegin={() => setOnEnd(false)}
onEndReached={() => {
          if (!onEnd) {
            onEndReached();
          }
 }}

@jothamc
Copy link

jothamc commented Sep 26, 2024

Following the guidelines on estimatedItemSize helped. I had initially thought it meant how many items would be displayed on each render, but fixing it appropriately solved the problem.

If the content doesn't fill the screen on initial render then the callback will fire. If it's being called incorrectly then most like the estimatedItemSize value is incorrect.

@natemartins
Copy link

Following the guidelines on estimatedItemSize helped. I had initially thought it meant how many items would be displayed on each render, but fixing it appropriately solved the problem.

If the content doesn't fill the screen on initial render then the callback will fire. If it's being called incorrectly then most like the estimatedItemSize value is incorrect.

@jothamc Could you explain further what exactly helped you? Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests