Home > Software engineering >  How to Show an image
How to Show an image

Time:12-26

I got 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 URL of that specific image link, but I am not able to map pictures cuz uri needs to be 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>
    )
  })

CodePudding user response:

If link is correctly defined this should work :

source={{ uri: key.link }}

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

CodePudding user response:

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}}
 />
  • Related