itinance / itinance/react-native-fs
unlink is not working.
- Dominant language
- C++
- Stars
- 5k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Description
react-native: 0.58.5
react-native-fs: 2.13.3
test it on simulator IPad Air2 and device IPad
My file path:
`file:///var/mobile/Containers/Data/Application/14E28AC2-5E35-4749-B09F-75DBEB0499A4/Library/Caches/Camera/6C6B1C9F-FDAF-4BEB-BEB0-126633336671.jpg`
I save the photo to my device's gallery by this:
```
import { CameraRoll } from 'react-native';
// save it to my device's gallery
CameraRoll.saveToCameraRoll(path);
```
Then I can see the jpg file on my device's gallery.
When I try to delete it
```
if (path !== '') {
RNFS.unlink(path).then(() => {
console.log('DELETED PHOTO');
})
// `unlink` will throw an error, if the item to unlink does not exist
.catch((err) => {
console.log(err.message);
});
}
```
I can see DELETED PHOTO on debug mode. But the picture is still on my device's gallery.
I try to change the delete path like this:
`const filePath = path.split('///').pop() // removes leading file:///`
It is still not working. Any one knows how to fix it ? Thanks.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.