将快照移动到图像文件夹
move snapshot to images folder
我正在使用 React-native 为 iOS 构建应用程序,并且我使用我的代码成功捕获了屏幕截图。问题是我想将快照移动到 Images 文件夹,以便用户可以轻松访问它。
我使用以下代码:
snapshot = async () => {
const targetPixelCount = 1080; // If you want full HD pictures
const pixelRatio = PixelRatio.get(); // The pixel ratio of the device
// pixels * pixelratio = targetPixelCount, so pixels = targetPixelCount / pixelRatio
const pixels = targetPixelCount / pixelRatio;
const result = await Expo.takeSnapshotAsync(this, {
result: 'file',
height: pixels,
width: pixels,
quality: 1,
format: 'png',
});
if (result) {
//RNFS.moveFile(result, 'Documents/snapshot.png');
Alert.alert('Snapshot', "Snapshot saved to " + result);
}
else {
Alert.alert('Snapshot', "Failed to save snapshot");
}
}
有谁知道如何将图片移动到图片文件夹?
谢谢
使用 RN CameraRoll 模块:https://facebook.github.io/react-native/docs/cameraroll
我正在使用 React-native 为 iOS 构建应用程序,并且我使用我的代码成功捕获了屏幕截图。问题是我想将快照移动到 Images 文件夹,以便用户可以轻松访问它。 我使用以下代码:
snapshot = async () => {
const targetPixelCount = 1080; // If you want full HD pictures
const pixelRatio = PixelRatio.get(); // The pixel ratio of the device
// pixels * pixelratio = targetPixelCount, so pixels = targetPixelCount / pixelRatio
const pixels = targetPixelCount / pixelRatio;
const result = await Expo.takeSnapshotAsync(this, {
result: 'file',
height: pixels,
width: pixels,
quality: 1,
format: 'png',
});
if (result) {
//RNFS.moveFile(result, 'Documents/snapshot.png');
Alert.alert('Snapshot', "Snapshot saved to " + result);
}
else {
Alert.alert('Snapshot', "Failed to save snapshot");
}
}
有谁知道如何将图片移动到图片文件夹?
谢谢
使用 RN CameraRoll 模块:https://facebook.github.io/react-native/docs/cameraroll