itinance / itinance/react-native-fs
write uploaded image
- Dominant language
- C++
- Stars
- 5k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Description
I'm trying to upload image using [react-native-image-crop-picker](https://github.com/ivpusic/react-native-image-crop-picker) and write the file to the `DocumentDirectoryPath` and render these images, the approach I'm using is that I upload the image, get the path of the image, append the `uuid()` to the filename and move the image using the `moveFile()` method, fetch the image name and store it in another .txt files, then I try to render the image in the `` tag but It keeps on not showing, here is the sample on uploading the image
```
writeFile: async resource => {
try {
let fullPath = "file://" + RNFS.DocumentDirectoryPath + "/" + uuid() + resource.filename
let moveFile = await RNFS.moveFile(resource.path, fullPath);
let documentDirectory = await RNFS.readDir(RNFS.DocumentDirectoryPath);
let storedFile;
let splitCurrentFileName = fullPath.split("/");
let currentFileName = splitCurrentFileName[splitCurrentFileName.length - 1];
let savedFile = documentDirectory.map(file => {
let splitFileName = file.path.split("/");
let filename = splitFileName[splitFileName.length - 1];
if (filename == currentFileName) {
storedFile = file.path;
}
});
return storedFile;
} catch (e) {
console.log(e);
}
},
```
what am I missing here ?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.