user9162890
user9162890

Reputation:

How can I get saved image location in React Native?

This is a code of taking screenshot and save it to storage. Now I need the location of saved image for email attachment. How can I get that location?

captureScreen({
      format: "jpg",
      quality: 0.8,
    })
    .then(
      uri => {
        CameraRollExtended.saveToCameraRoll({
          uri: uri,
          album: albumName,
        }, 'photo')
      },
      error => console.error("Oops, snapshot failed", error)
    );

Upvotes: 1

Views: 935

Answers (1)

Tukan
Tukan

Reputation: 2333

Per documentation, saveToCameraRoll function returns a Promise which will resolve with the new URI. As such, following code should help you with the issue you are having.

CameraRollExtended.saveToCameraRoll({
  uri: uri,
  album: albumName,
}, 'photo').then((newUri) => {
  console.log('new location of image => ', newUri);
})

Upvotes: 1

Related Questions