React native rn fetch blob取消下载-承诺拒绝
我用React Native下载文件 每件事情都正常工作,但当根据文档使用时,取消不工作并出现错误“fileFetchPromise未被删除” 我的代码:React native rn fetch blob取消下载-承诺拒绝,react-native,fetch-api,rn-fetch-blob,React Native,Fetch Api,Rn Fetch Blob,我用React Native下载文件 每件事情都正常工作,但当根据文档使用时,取消不工作并出现错误“fileFetchPromise未被删除” 我的代码: const download = () => { let fileOptions = { fileCache: true, path: path, }; const fileFetchPromise = config(fileOptions).fetch('GET', fileUrl); fileFetchPromise.p
const download = () => {
let fileOptions = { fileCache: true, path: path, };
const fileFetchPromise = config(fileOptions).fetch('GET', fileUrl);
fileFetchPromise.progress({ interval : 1000 }, (received, total) => {
let persend = 100 * received / total;
setSaved(persend.toFixed(0));
setReceived(bytesToSize(received));
setTotalSize(bytesToSize(total));
});
fileFetchPromise.then((data) => {
setSaved('100');
}).catch((err) => {
setSaved('0')
})
}
const cancelDownload = () => {
fileFetchPromise.cancel((err) => {})
}
如何取消(中止)提取?