Open thu-san opened 6 years ago
What would you like the actual behavior to be?
Sorry for late reply. I was thinking something like onError
props.
<Image
uri={'broken_url'}
onError={(e) => console.log}
/>
I edited the src/Image.js
like below and using in my project for now, but not sure it is the right approach.
async load({uri, options = {}, onError}: ImageProps): Promise<void> {
if (uri) {
try{
const path = await CacheManager.get(uri, options).getPath();
if (this.mounted) {
this.setState({ uri: path });
}
}
catch(e){
onError(e);
}
}
}
I would also expect onError
to be called when the request fails. Like 404 or 500. Right now we have no way of knowing and informing the user that the image failed and it just looks like it is still loading.
Pushed this one to address this issue https://github.com/wcandillon/react-native-expo-image-cache/pull/125
Is there anyway to handle broken url? Currently it shows warning Cannot download from '...url'