File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -59,10 +59,12 @@ class ReactNativeBlobUtilFetchPolyfill {
5959 // task.then is not, so we have to extend task.then with progress and
6060 // cancel function
6161 let progressHandler , uploadHandler , cancelHandler ;
62+ let scopedTask = null ;
6263 let statefulPromise = promise
6364 . then ( ( body ) => {
6465 let task = RNconfig ( config )
6566 . fetch ( options . method , url , options . headers , body ) ;
67+ scopedTask = task ;
6668 if ( progressHandler )
6769 task . progress ( progressHandler ) ;
6870 if ( uploadHandler )
@@ -87,8 +89,8 @@ class ReactNativeBlobUtilFetchPolyfill {
8789 } ;
8890 statefulPromise . cancel = ( ) => {
8991 cancelHandler = true ;
90- if ( task . cancel )
91- task . cancel ( ) ;
92+ if ( scopedTask && scopedTask . cancel )
93+ scopedTask . cancel ( ) ;
9294 } ;
9395
9496 return statefulPromise ;
You can’t perform that action at this time.
0 commit comments