Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
React native rn fetch blob取消下载-承诺拒绝_React Native_Fetch Api_Rn Fetch Blob - Fatal编程技术网

React native rn fetch blob取消下载-承诺拒绝

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

我用React Native下载文件 每件事情都正常工作,但当根据文档使用时,取消不工作并出现错误“fileFetchPromise未被删除”

我的代码:

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) => {})
}
如何取消(中止)提取?