itinance / itinance/react-native-fs

使用这个库android 保存图片到系统相册 手机有兼容性问题 有的手机可以保存 有的手机就保存失败

Open
#664 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
5k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

const RNFS = require('react-native-fs'); //文件处理
const storeLocation = `${RNFS.DocumentDirectoryPath}`;
let pathName = new Date().getTime() + "qrcode.png"
let downloadDest = `${storeLocation}/${pathName}`;
const ret = RNFS.downloadFile({fromUrl: item.orcode, toFile: downloadDest});
ret.promise.then(res => {
if (res && res.statusCode === 200) {
var promise = CameraRoll.saveToCameraRoll("file://" + downloadDest);
promise.then(function (result) {
Toast.message("图片已保存至相册")
}).catch(function (error) {
Toast.fail("图片保存失败");
})
}
})

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.