File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
packages/react-native-web/src Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -266,8 +266,12 @@ const Image: React.AbstractComponent<
266
266
updateState ( LOADING ) ;
267
267
if ( onLoadStart ) onLoadStart ( ) ;
268
268
269
+ let headers ;
270
+ if ( source && typeof source . headers === 'object' )
271
+ headers = ( ( source . headers : any ) : { [ key : string ] : string } ) ;
272
+
269
273
const requestId = ImageLoader . load (
270
- { uri, headers : source ?. headers } ,
274
+ { uri, headers } ,
271
275
function load ( result ) {
272
276
updateState ( LOADED ) ;
273
277
setLoadedUri ( result . uri ) ;
Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ const ImageLoader = {
93
93
) {
94
94
let complete = false ;
95
95
const interval = setInterval ( callback , 16 ) ;
96
- const requestId = ImageLoader . load ( uri , callback , errorCallback ) ;
96
+ const requestId = ImageLoader . load ( { uri } , callback , errorCallback ) ;
97
97
98
98
function callback ( ) {
99
99
const { image } = requests [ requestId ] || { } ;
@@ -182,7 +182,7 @@ const ImageLoader = {
182
182
prefetch ( uri : string ) : Promise < void > {
183
183
return new Promise ( ( resolve , reject ) => {
184
184
ImageLoader . load (
185
- uri ,
185
+ { uri } ,
186
186
( ) => {
187
187
// Add the uri to the cache so it can be immediately displayed when used
188
188
// but also immediately remove it to correctly reflect that it has no active references
@@ -205,7 +205,7 @@ const ImageLoader = {
205
205
}
206
206
} ;
207
207
208
- type ImageSource = { uri : string , headers ?: Record < string , string> } ;
208
+ type ImageSource = { uri : string , headers ?: { [ key : string ] : string } } ;
209
209
210
210
type ImageResult = {
211
211
uri : string ,
You can’t perform that action at this time.
0 commit comments