How to save a Picture to a specific folder from React Native Camera Roll

独自空忆成欢 提交于 2019-12-06 11:45:18

On Android, you can use react-native-fetch-blob and its File System Access API (PictureDir constant).

For example, I do:

try {
    const data = await this.camera.takePictureAsync()
    await RNFetchBlob.fs.mkdir(`${RNFetchBlob.fs.dirs.PictureDir}/myfolder`)
    await RNFetchBlob.fs.mv(
        data.api, 
        `${RNFetchBlob.fs.dirs.PictureDir}/myfolder/${moment().unix()}.jpg`
    )
} catch () {
    ...
}

https://github.com/wkh237/react-native-fetch-blob/wiki/File-System-Access-API

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!