Cameraroll React-Native

Asked

Viewed 201 times

0

I need to create a script that returns and list the images found in the user’s mobile gallery. For this, I am using the getPhotos method of the React-Native Cameraroll component

https://facebook.github.io/react-native/docs/cameraroll#getphotos

Both on IOS and Android, the array of images are returned correctly. but when I try to use the Uri image (using the Image component), on IOS it is displayed, but not on android.


Return of images on IOS ( result.edges.Node.image.Uri ):

Assets retornados no IOS


Return of images on Android ( result.edges.Node.image.Uri ):

Assets retornados no Android


Call code of the images:

<Image resizeMode="cover" style={[ styles.image_item ]} source={{ uri: image.node.image.uri }} />

Used React/Expo vesions:

Versões do react/expo

2 answers

0

The mistake is not in your prop styles? I saw that you passed an array as prop value, if I’m not mistaken the correct value is an object.

I think other than that, there is no other mistake. Your code is practically the same as mine.

      <Image
        source={{
          uri: this.state.displayImg.uri,
        }}
        style={{
          width: 40,
          height: 40,
          borderRadius: 8,
        }}
      />
  • The prop style is correct, I went through array because the styles are defined in another file. so much so that in IOS the images appear normally. I imagine the error may be in the value returned by Cameraroll on Android content://media/external/images/media/X

0

Try this:

style={Styles.image_item}

Inves of:

style={[ Styles.image_item ]}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.