according to the documentation:
On iOS, don't assume that the absolute uri returned will persist. See #107
I'm testing it on my android(Xiaomi) device and it works fine when I choose an image, but after closing the app and opening it again or re-running it using react-native run-android
, the uri
doesn't work anymore and instead of the image, I get a blueish color.
this is my code:
ImagePicker.showImagePicker({
storageOptions: {
skipBackup: true
}
}, res => {
// handling error, etc.
this.setState({image: res.uri});
// persisting with AsyncStorage
}
);
//then showing it
<Image style={{height: 100, width: 100}} source={{ uri: this.state.image }}/>
this is my uri after restarting the app:
content://com.miui.gallery.open/raw/%2Fstorage%2Femulated%2F0%2FDCIM%2FCamera%2FIMG_20190310_123752.jpg
It's strange because when I get the bluish color and again choose the same picture from my gallery I get the same uri as above and it works!!!although it's the same as before restarting. what can I do? thanks