We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 5e17a74 + 3c3fd48 commit 50ae139Copy full SHA for 50ae139
polyfill/Fetch.js
@@ -59,10 +59,12 @@ class ReactNativeBlobUtilFetchPolyfill {
59
// task.then is not, so we have to extend task.then with progress and
60
// cancel function
61
let progressHandler, uploadHandler, cancelHandler;
62
+ let scopedTask = null;
63
let statefulPromise = promise
64
.then((body) => {
65
let task = RNconfig(config)
66
.fetch(options.method, url, options.headers, body);
67
+ scopedTask = task;
68
if (progressHandler)
69
task.progress(progressHandler);
70
if (uploadHandler)
@@ -87,8 +89,8 @@ class ReactNativeBlobUtilFetchPolyfill {
87
89
};
88
90
statefulPromise.cancel = () => {
91
cancelHandler = true;
- if (task.cancel)
- task.cancel();
92
+ if (scopedTask && scopedTask.cancel)
93
+ scopedTask.cancel();
94
95
96
return statefulPromise;
0 commit comments