My folder structure :
-assets
--images
---potrait.png
-src
--file.js
I want to load my image in file.js but it throws error
<Image source={require('../assets/images/potrait.png')} />
Error:
error: Error: Unable to resolve module ../assets/images/potrait.png from D:\munish\Desktop\Invictus\reach-app\src\reactNativeCamera.js:
None of these files exist:
Sadly, react disables imports outside of src. You should move them to inside the src or to the public folder where it can be accessed through / ( not recommended because it will replicate the image, should be avoided for the best optimization ).
Have you tried this syntax?
<Image source={{uri: localPath}}/>