Cached Image component for Expo?

Anyone knows of a image component that locally caches images and works with Expo? The ones I found all needed to link native modules.

Thanks!
Marcus

Can you give an example of what you’re trying to do? Our asset system handles caching for you: https://docs.expo.io/versions/latest/guides/preloading-and-caching-assets.html

I have lots of remote images in my app that are static (if the image changes, the uri will change, too).

The same images will be shown from seperate components and the same images will be shown with each and every new run of the app.

I want to make sure that each image is fetched only once per uri.

Did you look at the link I posted? I think we cover your use case.

Image · React Native and How React Native Image.prefetch works? - Stack Overflow answered all questions I had.

Thanks for your help!
Marcus

1 Like

@minibbjd So am I correct in understanding that it only caches it so long as the component that prefetched it is mounted, i.e. if you restart the app, the cache is emptied?

@minibbjd if you want there is an article that explains how to implement a cache in js Caching your images on react-native with Expo | by Jérémie Drouet | One More Thing Studio | Medium

I just finished an expo component for image caching, you can check it out at 5 Things to know about Images in React Native | by William Candillon | Medium and GitHub - wcandillon/react-native-expo-image-cache: React Native Image Cache and Progressive Loading based on Expo.

3 Likes