File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed
packages/react-native-web/src Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -386,7 +386,8 @@ describe('components/Image', () => {
386
386
) ;
387
387
388
388
// Both defaultSource and source are loaded at the same time
389
- // But we assume defaultSource is loaded quicker
389
+ // Since `defaultSource` is meant to be displayed until `source` loads
390
+ // we resolve it first (otherwise it won't be displayed at all)
390
391
act ( ( ) => {
391
392
const call = calls . find ( ( { source } ) => source . uri === defaultUri ) ;
392
393
call . onLoad ( { source : call . source } ) ;
Original file line number Diff line number Diff line change @@ -86,6 +86,7 @@ const ImageLoader = {
86
86
87
87
image . onerror = null ;
88
88
image . onload = null ;
89
+ // Setting image.src to empty string aborts any ongoing image loading
89
90
image . src = '' ;
90
91
ImageUriCache . remove ( source . uri ) ;
91
92
delete requests [ requestId ] ;
@@ -157,7 +158,7 @@ const ImageLoader = {
157
158
image . onload = handleLoad ;
158
159
requests [ id ] = { image, source } ;
159
160
160
- // When headers are supplied we can't load the image through `image.src`, but we `fetch` it as an AJAX request
161
+ // It's not possible to use headers with `image.src`, that's why we use a different strategy for sources with headers
161
162
if ( source . headers ) {
162
163
const abortCtrl = new AbortController ( ) ;
163
164
const request = new Request ( source . uri , {
You can’t perform that action at this time.
0 commit comments