Move image to gallery with react native

Viewed 52

I use the module react-native-view-shot to capture an image. The resulting uri looks as following

const result = '/private/var/mobile/Containers/Data/Application/7009B302-3CDC-462C-82E8-9B****/tmp/ReactNative/2814DEB1-DDAD-43F7-96D1-AE2B2***.png'

I do not see the image in the gallery after the capture, how can I move it there?

1 Answers

you can get location uri file saved with

captureRef(viewRef, {
  format: "jpg",
  quality: 0.8
}).then(
  uri => console.log("Image saved to", uri),
  error => console.error("Oops, snapshot failed", error)
);

but your result location is only when the app is running

from doc

result (string), the method you want to use to save the snapshot, one of: "tmpfile" (default): save to a temporary file (that will only exist for as long as the app is running).

Related