React Native Gallery

Viewed 38

I can not iterate dynamically all the images from JSON array api.

import Gallery from 'react-native-image-gallery';

setGalleryIMG(data.result[0].postmeta._job_gallery === "" ? AuthVars.BLANK_IMAGE :     data.result[0].postmeta._job_gallery);

<Gallery
style={{ flex: 1, backgroundColor: 'black'}}
  images={[
   { source: { uri: galleryIMG[0] } },
   { source: { uri: galleryIMG[1] } },
   { source: { uri: galleryIMG[2] } }
  ]}
/>

How can I dynamically iterate all images from the galleryIMG object? If I remove the [0] key I get error. Posts have different number of images.

0 Answers
Related