Luehang/react-native-image-layout

[BUG] onEndReached firing over and over when screen loads

Opened this issue · 1 comments

To Do First

  • [ x ] Did you try latest release?
  • [ x ] Did you look for existing matching issues?

Software Package Version:
5.2.0

Describe the bug
When I try to implement onEndReachedThreshold and onEndReached, the same way I have implemented those on different screens of my app, as soon as the grid screen loads up it keeps firing onEndReached over and over, making the list of images very slow and unresponsive. I have it to load only 20 images first and then when scrolling back I want it to load the next 20, and so on.

To Reproduce
Just implement onEndReached and onEndReachedThreshold and check either debugging logs or how it becomes slow and unresponsive with 100s of images loaded one batch after the other.

Expected behavior
Start loading the next 20 images after I scroll to the bottom.

Screenshots
N/A

Version (please complete the following information):

  • Device: iPhone X Simulator
  • Android: N/A
  • iOS: 12.2
  • react-native: 0.59.8
  • react: 16.8.6

Additional context
N/A

I have the same issue. URL for the images are not local in my case. Every time the image is loaded, onEndReached is called. So I have array with 3 images and onEndReached is called 3 times. When I scroll down, onEndReached is called 4th time.