Reputation: 133
I have an Image that I've downloaded and saved to the path /data/user/0/com.project/files/assets/image.png
and I want to use this in my Image component in React-Native. Is there a way to use images stored in this path?
Ways to solve it that I have knowledge of but cannot use :
require
. which basically accepts literal strings that is not what I want for non-static images. names may change as per image for a single image sourceUpvotes: 2
Views: 3661
Reputation: 1250
If it's a file on your device, I think the way of displaying it is somewhat like this:
<Image source={{uri:'file:///data/user/0/com.project/files/assets/image.png'}} style={{width: 100, height: 100}}/>
Just make sure the file path is from the root. Hope it works for you.
Upvotes: 9