GetStream / react-native-bidirectional-infinite-scroll

📜 React Native - Bidirectional Infinite Smooth Scroll
https://getstream.github.io/react-native-bidirectional-infinite-scroll/
MIT License
236 stars 27 forks source link

Never ending loading when onEndReached and onStartReached are called simultaneously #4

Closed mattproch closed 3 years ago

mattproch commented 3 years ago

If both onEndReached and onStartReached are called at the same time (eg. the list of data is really short) the end loading indicator never stops loading.

Video

https://user-images.githubusercontent.com/20935135/109646003-ea683080-7b57-11eb-9de8-611acde53f20.mov

Basic setup to reproduce:

<FlatList
  data={[1, 2, 3]}
  renderItem={() => (
    <View style={{ marginBottom: 20, backgroundColor: '#102C1A', height: 100, width: '100%' }} />
  )}
  keyExtractor={(item) => item.toString()}
  onStartReached={loadPrevious}
  onStartReachedThreshold={0.2}
  onEndReached={loadAfter}
  onEndReachedThreshold={0.2}
/>
const loadPrevious = async () => {
  console.log('PREVIOUS START');

  return new Promise<any>((resolve) =>
    setTimeout(() => {
      console.log('PREVIOUS RESOLVE');
      resolve(null);
    }, 1000),
  );
};
const loadAfter = async () => {
  console.log('AFTER START');

  return new Promise<any>((resolve) =>
    setTimeout(() => {
      console.log('AFTER RESOLVE');
      resolve(null);
    }, 2000),
  );
};
vishalnarkhede commented 3 years ago

@mattproch thanks for brining this up. I will take a look soon :)

vaclavikjan commented 3 years ago

@vishalnarkhede, any update about this issue? Thanks!

vishalnarkhede commented 3 years ago

@vaclavikjan I will take a look tomorrow :)

vishalnarkhede commented 3 years ago

@vaclavikjan @mattproch Could you please try new patch that I just published? 0.3.2

vishalnarkhede commented 3 years ago

Closing this for now. Please reopen if you still see the issue :)

vaclavikjan commented 3 years ago

@vishalnarkhede, the issue is fixed. Thanks a lot!

devvrat-sharma commented 1 year ago

I am facing this issue . Is it not resolved yet?