【发布时间】:2018-06-04 00:28:15
【问题描述】:
我正在尝试在我的应用中使用 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创建了我的项目
有什么想法吗?
【问题讨论】:
标签: javascript android ios react-native react-native-fs