Hi, i been encoutering a constant warning while trying to pre-load my images on my application, i tried loading them both ways, the older one e new most recent as sugested by the sdk-32 documentation from expo. This causes my image either not to load on the app,or if/when (usally takes a while) they load, on switching routes with React-Nativation they reload, causing them to flicker. can someone help ?
EDIT: this “flickering” doesn’t happen on android from what i noticed, only on IOS, and they are structured as this recommends: https://docs.expo.io/versions/latest/react-native/images/
render() {
if (!this.state.isLoadingComplete) {
return (
<AppLoading
startAsync={this._loadResourcesAsync}
onError={this._handleLoadingError}
onFinish={this._handleFinishLoading}
/>
);
} else {
return (
<Provider store={Store}>
<View style={Build.container}>
<StatusBar barStyle="light-content"/>
<AppNavigator />
<NotificationReader/>
</View>
</Provider>
);
}
}
- The new way:
async _loadResourcesAsync() {
const images = [
require('./assets/images/icons/icone-contact/icon-contact.png'),
require('./assets/images/icons/icone-blog/icon-blog.png'),
require('./assets/images/icons/icone-site/icon-site.png'),
];
const cacheImages = images.map((image) => {
return Asset.fromModule(image).downloadAsync();
});
return Promise.all([
cacheImages,
Font.loadAsync({
'Futura Md BT': require('./assets/fonts/tt0142m.ttf'),
'Futura Md BT Italic': require('./assets/fonts/tt0143m.ttf'),
'Futura Md BT Bold': require('./assets/fonts/tt0144m.ttf'),
'Futura MD BT BoldItalic': require('./assets/fonts/tt0145m.ttf'),
'OpenSans EB': require('./assets/fonts/OpenSans-ExtraBold.ttf'),
'OpenSans': require('./assets/fonts/OpenSans-Regular.ttf'),
}),
]);
- Older method
async _loadResourcesAsync() {
return Promise.all([
Asset.loadAsync([
require('./assets/images/icons/icone-contact/icon-contact.png'),
require('./assets/images/icons/icone-blog/icon-blog.png'),
require('./assets/images/icons/icone-site/icon-site.png'),
]),
Font.loadAsync({
'Futura Md BT': require('./assets/fonts/tt0142m.ttf'),
'Futura Md BT Italic': require('./assets/fonts/tt0143m.ttf'),
'Futura Md BT Bold': require('./assets/fonts/tt0144m.ttf'),
'Futura MD BT BoldItalic': require('./assets/fonts/tt0145m.ttf'),
'OpenSans EB': require('./assets/fonts/OpenSans-ExtraBold.ttf'),
'OpenSans': require('./assets/fonts/OpenSans-Regular.ttf'),
}),
]);
};
the warning returned is:
Unhandled promise rejection: Error: Downloaded file for asset ‘icon-blog.png’ Located at http://myip/assets/assets/images/icons/icone-blog/icon-blog@2x.png?platform=ios&hash=617c5310b4eda2ef806ff04825ebacd2 failed MD5 integrity check
my current package.json
"expo": "^32.0.0",
"expo-cli": "^2.5.0",
"npm": "^6.8.0",
"react": "16.5.0",
"react-native": "0.57.1",
"react-native-calendars": "^1.21.0",
"react-native-keyboard-aware-scroll-view": "^0.7.4",
"react-navigation": "^2.16.0",
"react-redux": "^6.0.0",
"redux": "^4.0.1"