react-native-expo-image-cache
react-native-expo-image-cache copied to clipboard
Loading many images at same time / Some other things
Hello!
I have a problem with loading a few hundred images. I have a FlatList with containing scrollviews in each cell that will display the images with horizontal scrolling. When the cache is empty and the app starts, all images begin to load at the same time. Many images fail because of timeout. I think there must be something like a queue to load the images in batches or so. Any suggestions to improve that?
The other thing I've notice is that it seams that the images starts to load first at the bottom of the list. Why they don't start at the top where the user is look at after start?
An other thing I want to improve is to remove re-rendering. A have a list in grid view style with many images. When I try to add a new item the hole FlatList get refreshed and all images show the preview and load again. What can I do to prevent re-rendering?
I there a way to add an image that is local available to the cache? So that a download of the image is not needed after uploading to the server.
Thanks for your help.
@Werewolve Thank you for reaching out.
Regarding the FlatList, you should only the visible images. The problem is that if you scroll down quickly to the bottom of the list, the component didn't cancel any request. When trying to implement this with resume/cancel download API from Expo there were simply too many bugs, I'm waiting for improvements on this side.
Regarding "re-rendering" I agree that the current behavior is not optimal. I'm waiting for the suspense API to implement a more graceful behaviour since it will allow the component to check the local cache before rendering anything. However in the meantime, I'm sure that you can tweak this component to build a behaviour that works for you.
@wcandillon Any news here so far? I still have this problems, next step would be then to detach and use something else.