Ahsan Ahmed
Ahsan Ahmed

Reputation: 133

Images from Device storage custom path In React Native

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 :

Upvotes: 2

Views: 3661

Answers (1)

Ketan Malhotra
Ketan Malhotra

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

Related Questions