I have been working on implementing react-native-fs into my app for file uploading purposes. I carefully followed the installation steps mentioned in the documentation, imported the required modules, and added the following code snippet for testing:
componentDidMount(){
const path = RNFS.DocumentDirectoryPath + '/test.txt';
console.log(path);
// write the file
RNFS.writeFile(path, 'Lorem ipsum dolor sit amet', 'utf8')
.then((success) => {
console.log('FILE WRITTEN!');
})
.catch((err) => {
console.log(err.message);
});
}
Unfortunately, when running this code, I encountered the following error:
https://i.sstatic.net/5TTxs.png ps: My project was created using create-react-native-app
Does anyone have any suggestions or solutions to this issue?