Hi peps,
first of all, awesome tool to get started with React Native:)
I’m prefetching images the way the docs explanes it, but I get a warning, when caching the image from the example (it’s still https). And when they are prefetch, how do I refer to the when i want to use them in the tag – do I just use the url or …?
_loadResourcesAsync = async() => {
const imageAssets = cacheImages([
//'https://orsted.dk/-/media/WWW/Images/DCS/2018/10/Vaskemaskine.ashx?la=da&mh=720&mw=720&hash=443E700913D059E322FE01F5BFB03F5433447288',
require('./../assets/images/icon.png'),
require('./../assets/images/splash.png'),
]);
const fontAssets = cacheFonts([
{'OrstedRegular': require('./../assets/fonts/OrstedSans-Regular.ttf'),
'OrstedBold': require('./../assets/fonts/OrstedSans-Bold.ttf'),
'OrstedLight': require('./../assets/fonts/OrstedSans-Light.ttf')}
]);
await Promise.all([...imageAssets, ...fontAssets]);
}
cacheImages = (images) => {
return images.map(image => {
if (typeof image === 'string') {
return Image.prefetch(image);
} else {
return Asset.fromModule(image).downloadAsync();
}
});
}