反应原生:0.61.2 反应原生 fs:^2.16.2
我想在外部存储中创建一个新目录。我预计“可能的未处理承诺拒绝(id:2):错误:无法创建目录”
export function createDirCategory(fileName) {
const file = `${dirHome}/${fileName}`;
return new Promise((resolve, reject) => {
RNFS.mkdir(file)
.then(() => {
resolve(true);
})
.catch(error => {
reject(error);
});
});
};
addCategorty() {
const {categoryName} = this.state;
createDirCategory(categoryName);
const folderUrl =getDirUrl(categoryName);
let id =
Math.random()
.toString(36)
.substring(2) + Date.now().toString(36);
this.props.changeState;
store.push('categories', {
id,
categoryName,
imageUrl: [],
folderUrl,
});
this.setState({categoryName: ''});
}