Search code examples
imagereact-nativecomponents

How do I render image component based on the image uri inside an array in React Native?


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


Solution

  • 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"}} />)
       })