Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to save image to Camera Roll using Expo?

I'm creating an app using Expo to take picture, I'm already possible to save pictures to FileSystem.documentDirectory, but this is not what I want.

I tried to save image to Camera Roll using code like this:

import { CameraRoll } from 'react-native';
...
...
await CameraRoll.saveToCameraRoll(photo.uri);

But it's returning a warning me to use react-native-cameraroll instead of react-native. But as I see in the document of the react-native-cameraroll, it's seems not supporting Expo.

Is there any way to save image to Camera Roll in Expo?

like image 377
Lai32290 Avatar asked Jan 05 '20 18:01

Lai32290


1 Answers

I found the solution to this, instead of using CameraRoll you can use MediaLibrary to MediaLibrary.saveToLibraryAsync(localUri)

More details on the documentation

like image 54
Lai32290 Avatar answered Sep 21 '22 23:09

Lai32290