How to save image to Camera Roll using Expo?

Lai*_*290 7 react-native 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.

我试图将图像保存到 Camera Roll using code like this:

import { CameraRoll } from 'react-native';
...
...
await CameraRoll.saveToCameraRoll(photo.uri);
Run Code Online (Sandbox Code Playgroud)

但它返回一个警告我使用react-native-cameraroll而不是react-native. But as I see in the document of the react-native-cameraroll, it's seems not supporting Expo.

有没有办法将图像保存到相机胶卷中Expo

Lai*_*290 14

我找到了解决这一点,而不是使用CameraRoll您可以使用MediaLibraryMediaLibrary.saveToLibraryAsync(localUri)

有关文档的更多详细信息

  • 谢谢!为什么世博相机文档页面上没有记录这一点。我需要的一切都没有记录在案 (3认同)