0

I got a bunch of data from my database and I am mapping all of them, my image field is also part of that database and in that, I am storing the URL of that specific image link, but I am not able to map pictures cuz URI needs to be a string and the data I am getting is of type int, here is the code

Code

data.map((key)=>{ return( <View> <Image style={styles.myImage} source={{ uri:`${key.link}` }} /> </View> ) }) 
2
  • "uri needs to be string and the data I am getting is of type int". What do you mean by this can you share the data which your receiving Commented Dec 26, 2022 at 4:46
  • @Alpha i am getting the url of images that is stored in the database and it seems pretty fine. Commented Dec 26, 2022 at 9:52

2 Answers 2

1

If link is correctly defined this should work :

source={{ uri: key.link }} 

But make sur you have set width/height in your style

 style={{height: your_height, width: your_width} 
Sign up to request clarification or add additional context in comments.

Comments

1

If you are sure that the image is coming in that link then you just have to pass a height and width for that image.

 <Image source={{ uri:`${key.link}` }} style={{height:100, width:100}} /> 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.