我正在尝试在我的应用程序中使用 react-native-fs 来上传文件等。我按照文档中的安装进行了导入,然后我将这段代码用于测试:
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);
});
}
它直接给我这个错误:
ps:我通过 create-react-native-app 创建了我的项目
有任何想法吗?