using download dir for downloaded images

This commit is contained in:
Roland Osborne 2024-06-07 16:00:42 -07:00
parent 0430403e01
commit 03d83b6be4

View File

@ -78,7 +78,7 @@ export function useImageAsset(asset) {
if (!state.downloaded) {
updateState({ downloaded: true });
const epoch = Math.ceil(Date.now() / 1000);
const dir = Platform.OS === 'ios' ? RNFetchBlob.fs.dirs.DocumentDir : RNFetchBlob.fs.dirs.PictureDir;
const dir = Platform.OS === 'ios' ? RNFetchBlob.fs.dirs.DocumentDir : RNFetchBlob.fs.dirs.DownloadDir;
const path = `${dir}/databag_${epoch}.jpg`
if (state.url.substring(0, 7) === 'file://') {
await RNFS.copyFile(state.url.substring(7).split('?')[0], path);