Hi!
FastImage.preload works fine on IOS, but doesn't work on Android.
I have tried on Pixel 2 XL (Android 10) and Redme 4X (Android 6.0.1).
react-native-fast-image - "^8.1.5"
react-native - "0.61.2"
@DylanVann maybe I missed some additional steps for running it on Android?
"react-native": "0.60.5",
"react-native-fast-image": "^8.1.5"
I use
FastImage.preload([{ uri: 'https://xxxxxxx./1.png' }, { uri: 'https://xxxxxxx./1.png' }])
but the images are loading not ahead of time
I expect they appear immediately, but they are loading (like they are not preloaded)
<FastImage
style={[styles.defaultIcon, iconStyle]}
source={{
uri: imageUri, // 'https://xxxxxxx./1.png'
priority: FastImage.priority.high,
}}
resizeMode={FastImage.resizeMode.contain}
onLoad={this.onLoad}
/>
Please, tell me what I am doing wrong?
@vitto-moz
yes, preload method is not Promise, you can see it in the interface
interface FastImageStaticProperties {
resizeMode: typeof resizeMode;
priority: typeof priority;
cacheControl: typeof cacheControl;
preload: (sources: Source[]) => void;
}
As option you can try to simulate some delay before rendering the images, but it's tricky, you never know when all images will be loaded
there is my case:
I have the app screen, not the main one (1), which appears right after the app started, but those (2) I should switch to from the main one (1).
as a part of the initialization I use
FastImage.preload([{ uri: 'https://xxxxxxx./1.png' }, { uri: 'https://xxxxxxx./1.png' }])
then after a 1 minute, I'm switching to the screen, where I use these images (guess the minute should be enough). But the images behave like they loading the first time.
@vitto-moz Is it the same behaviour on IOS and Android ?
@avet-m we have an android only app, I will try to make the ios build and let you know
Same here.
I'm using Image.getSize() to preload/cache images for now.
any updates on it? it works perfectly on iOS but it's like no any preload effect for Android. I still see the image is loading (flickering)
Most helpful comment
any updates on it? it works perfectly on iOS but it's like no any preload effect for Android. I still see the image is loading (flickering)