File tree 2 files changed +11
-5
lines changed
packages/react-native-web/src
2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -362,12 +362,16 @@ const ImageWithHeaders: ImageComponent = React.forwardRef((props, ref) => {
362
362
const { onError, onLoadStart, onLoadEnd } = props ;
363
363
364
364
React . useEffect ( ( ) => {
365
- if ( ! hasSourceDiff ( nextSource , request . current . source ) ) return ;
365
+ if ( ! hasSourceDiff ( nextSource , request . current . source ) ) {
366
+ return ;
367
+ }
366
368
367
369
// When source changes we want to clean up any old/running requests
368
370
request . current . cancel ( ) ;
369
371
370
- if ( onLoadStart ) onLoadStart ( ) ;
372
+ if ( onLoadStart ) {
373
+ onLoadStart ( ) ;
374
+ }
371
375
372
376
request . current = ImageLoader . loadWithHeaders ( nextSource ) ;
373
377
@@ -383,8 +387,10 @@ const ImageWithHeaders: ImageComponent = React.forwardRef((props, ref) => {
383
387
384
388
const propsToPass = {
385
389
...props ,
390
+
386
391
// Omit `onLoadStart` because we trigger it in the current scope
387
392
onLoadStart : undefined ,
393
+
388
394
// Until the current component resolves the request (using headers)
389
395
// we skip forwarding the source so the base component doesn't attempt
390
396
// to load the original source
Original file line number Diff line number Diff line change @@ -150,10 +150,10 @@ const ImageLoader = {
150
150
} ,
151
151
loadWithHeaders ( source : ImageSource ) : LoadRequest {
152
152
let uri : string ;
153
- const abortCtrl = new AbortController ( ) ;
153
+ const abortController = new AbortController ( ) ;
154
154
const request = new Request ( source . uri , {
155
155
headers : source . headers ,
156
- signal : abortCtrl . signal
156
+ signal : abortController . signal
157
157
} ) ;
158
158
request . headers . append ( 'accept' , 'image/*' ) ;
159
159
@@ -175,7 +175,7 @@ const ImageLoader = {
175
175
promise,
176
176
source,
177
177
cancel : ( ) => {
178
- abortCtrl . abort ( ) ;
178
+ abortController . abort ( ) ;
179
179
URL . revokeObjectURL ( uri ) ;
180
180
}
181
181
} ;
You can’t perform that action at this time.
0 commit comments