Even though I cache all the local images while the app loads, a screen with lots of images load very slow. It looks like as if the images load sequentially which looks very unprofessional. How do you guys solve these problems, is there a pattern I need to follow?
I’m also interested in this. I have a lot of screens with background images and even switching from one screen to another and then back, the screen that was already loaded takes forever for the image to show up again. It looks super unprofessional.
@ryanvanderpol As long as the images are not loaded from the bundle, this is a no go for me. I’m porting my code to react native at the moment.
Please look here:
@onselakin yeah, I agree. I’ve already got too much invested in Expo to change now, but I’m pretty disappointed with how image assets are handled. Here’s another thread I started about the issues I’ve been seeing: Disappearing images - #8 by ide
Hiya. I am also interested in the best way to serve up lots of background images. Do we have any progress here yet? I have considered it could be down to the way my app is built, maybe I should be using a FlatList rather than a ListView, this would allow each page to load in as the user scrolls, but then I guess the image may still load slowly.
My current issue is the load time of my app due to the amount of images loading in one go.
So, I just had a small breakthrough. The same way in which I am async loading fonts, I can async load assets, my images, this has improved performance greatly.
This link is Expo example code showing how: https://github.com/expo/new-project-template/blob/master/App.js
@philipjc_apacio can you provide some more example code on how to finish this process? I tried implementing the example code and the images won’t even load. I went as far as cloning the repository and loading it from scratch and the app will not get past the “AppLoading” state as the images are never even cached.
Hey, cruz. Sure, I can show you how I did this. I performed my loading inside componentWillMount using an async await function. My render shows the loading spinner while the loading is happening. At the end of the async function I call navigate to the first screen.
For right or wrong, I am yet to discover, I still just require the image in the file I am using it. I guess you could pass them as props if you wanted. I just kept all my requires in the component pages.