kfiroo / react-native-cached-image

CachedImage component for react-native
MIT License
938 stars 470 forks source link

ImageCachePreloader.preloadImages() #117

Closed aaronallan closed 6 years ago

aaronallan commented 6 years ago

Hello,

In previous versions of this library, I used ImageCacheProvider.cacheMultipleImages() to cache a bundle of images (~250) when my app instantiated. The images are rendered in a time sensitive modal that only displays for 5-10 seconds, so I need to ensure they're available in advance.

I see that <ImageCacheProvider/> calls ImageCachePreloader.preloadImages() but would prefer to load these images when the app starts as opposed to when the modal component mounts.

Is it safe to replace ImageCacheProvider.cacheMultipleImages() with the below implementation when the app starts?

const images ['1.jpg' , '2.jpg', '3.jpg'];
const ICM = new ImageCacheManager();

ImageCachePreloader.preloadImages(images, ICM, 10);

Thank you, Aaron