我需要将图像保存在应用程序的特定文件夹中。我正在使用lib react-native-fs。
export const saveGalery = async (viewShot, page) => {
var path = RNFS.DocumentDirectoryPath;
let tmp;
try {
viewShot.current.capture().then(uri => {
tmp = uri;
RNFS.writeFile(path, tmp, 'utf8')
.then(success => {
alert('FILE WRITTEN!');
})
.catch(err => {
alert(err.message);
});
});
} catch (e) {
alert('Não salvo: ' + e);
}
};