I am using react-native-camera to click on the images. I get the file path, for example: "file: ///storage/emulated/0/Pictures/IMG_20161228_021132.jpg" in the data from the camera, which I keep in state. I can use this as a source to display the image using the component "Image Source = {{uri: this.props.note.imagePath.path}}" and it displays correctly.
Now I want to add image removal functionality. Can someone suggest how to access this image on the phone using the path mentioned above and delete it from the phone.
I checked react-native-filesystem , but when I used the checkIfFileExists function that goes along this path, I realized that the file does not exist. Not sure what is going wrong.
async checkIfFileExists(path) {
const fileExists = await FileSystem.fileExists(path);
console.log(`file exists: ${fileExists}`);
}
deleteNoteImage (note) {
console.log(note.imagePath.path);
this.checkIfFileExists(note.imagePath.path);
note.imagePath = null;
this.updateNote(note);
}

source
share