Expo App Loading


#1

Hello Friends

I am using [ AppLoading ] and I have a question about

there I have a Root Navigator and the othere nested navigator

in root navigator i can access my asset like bellow

1: <Image source = { require(’./assets/images/myimage.png’) }>

in second nested navigator I can access my asset like bellow

2: <Image source = { require(’…/…/assets/images/myimage.png’) }>

there I just added the first number to cache using [ AppLoading ]

So my questions is:

question 1: Is it possible get the image in nested navigator like number 2 from cache ???

question 2: when I use [ AppLoading ] I can access it as well but when I update the image that still bring the old image not the updated image so how over come this problem???

for example I want to access image befor update like bellow:

1: <Image source = {{ uri: ‘http://barnama.me/muhammad.png’ }}>

here the image is 1mb

but after updating the image i can access it same as befor like bellow:

2: <Image source = {{ uri: ‘http://barnama.me/muhammad.png’ }}>

there as you can see the url didnt changed but actually the image has been changed,

for example before update image size is 100kb after update is 200kb there are different binaries

so how to access it the updated image I used AppLoading but it retreive the old image.

Most Regards
Muhammad Wafa


#2

Hi, muhammad!

For your first question, cached and prefetched images can be required just like any other.

As far as your second question, AppLoading acts as a cache in order to save unnecessary downloads. As long as you use the same uri for the image, and the cache hasn’t been cleared, the app won’t know that the image on your server has changed. But if the cache was emptied, or if the app was started on a second phone, then the new image would be downloaded. We wrote a guide to preloading and caching that may help you.

One strategy I’ve seen used is to always host assets with unique filenames, and deploy an app update when you want to change the asset. For a very simple example, you could keep the larger file (so people who haven’t updated your app can still load it), and upload the smaller file with the name muhammad2.png. Typically people will use a tool to automatically append the unique portion of the filename, such as gulp-rev.


#3

Thank you so much for the reply
and please let me know a bit more about my first question
Regards
Muhammad Wafa


closed #4

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.