I am trying to load image from external sdcard after I take photo from camera in React native image component as following, but it is not rendering in android. I even checked if there is image missing at that location, but that's not the problem. But it works well in case of iOS to load image from location after taking photo from camera.
<Image source={{uri:'/storage/emulated/0/Pictures/image-0ea0d714-9469-432b-8869-b6637be2be10.jpg'}} style={{height:200, width:200}} />
Here's my permission list in AndroidManifest.xml
<!-- For Image picker start -->
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-feature android:name="android.hardware.camera" android:required="false"/>
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>
Just had this issue, solved it by prepending the filepaths with file://
So, instead of:
<Image source={{uri:'/storage/emulated/0/Pictures/myImage.jpg'}} style={myImageStyle} />
Use:
<Image source={{uri:'file:///storage/emulated/0/Pictures/myImage.jpg'}} style={myImageStyle} />
Note the 3 consecutive slashes as opposed to just two as suggested by @Cherniv.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With