Reputation: 1306
I have an array of image URI.
["file:///data/user/0/com.app.outlet/cache/react-native-image-crop-picker/22536474236950.png","file:///data/user/0/com.app.outlet/cache/react-native-image-crop-picker/22583225016770.png"]
I want to render the image component based on the length of the array and show and show all the images. How can I do it in react native
Upvotes: 0
Views: 430
Reputation: 118
If you have image in array you can use map function and display in image component
data = ['a.png',b.png']
data.map((item,index)=>{<Image src={item.data })
like that it is just demo example
Upvotes: 0
Reputation: 784
I believe this will help you:
var array = ["file:///data/user/0/com.app.outlet/cache/react-native-image-crop-picker/22536474236950.png","file:///data/user/0/com.app.outlet/cache/react-native-image-crop-picker/22583225016770.png"]
array.map((x)=>{
return(<Image source={x || whatever you want } style={{xx:"xx"}} />)
})
Upvotes: 1