Skip to content

Commit d582c91

Browse files
author
Jan Karres
committed
wkh237#555 Cancel download throw error bugfix (Android)
1 parent 4205ebc commit d582c91

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,13 @@ function fetch(...args:any):Promise {
229229
}
230230

231231
// from remote HTTP(S)
232+
let promiseResolve;
233+
let promiseReject;
234+
232235
let promise = new Promise((resolve, reject) => {
236+
promiseResolve = resolve;
237+
promiseReject = reject;
238+
233239
let nativeMethodName = Array.isArray(body) ? 'fetchBlobForm' : 'fetchBlob'
234240

235241
// on progress event listener
@@ -370,6 +376,7 @@ function fetch(...args:any):Promise {
370376
subscriptionUpload.remove()
371377
stateEvent.remove()
372378
RNFetchBlob.cancelRequest(taskId, fn)
379+
promiseReject(new Error("canceled"))
373380
}
374381
promise.taskId = taskId
375382

0 commit comments

Comments
 (0)