When I download the image to ExternalStorageDirectoryPath in android
it does not appear in gallery.
Just when I restart my phone it appears
any help??
This code solves your problem.
import { CameraRoll } from 'react-native';
const imagePath = `${RNFS.TemporaryDirectoryPath}/${((Math.random() * 1000) | 0)}.jpeg`;
RNFS.downloadFile({
fromUrl: imageUrl,
toFile: imagePath,
progress: (e) => console.log(e),
begin: (s) => console.log(s),
}).promise
.then(() => {
CameraRoll.saveToCameraRoll(id, "photo");
})
.catch((e) => {
})
Most helpful comment
This code solves your problem.