@@ -157,6 +157,7 @@ function raiseOnErrorEvent(uri, { onError, onLoadEnd }) {
157
157
}
158
158
if ( onLoadEnd ) onLoadEnd ( ) ;
159
159
}
160
+
160
161
function hasSourceDiff ( a : ImageSource , b : ImageSource ) {
161
162
return (
162
163
a . uri !== b . uri || JSON . stringify ( a . headers ) !== JSON . stringify ( b . headers )
@@ -342,8 +343,11 @@ const BaseImage: ImageComponent = React.forwardRef((props, ref) => {
342
343
) ;
343
344
} ) ;
344
345
346
+ BaseImage . displayName = 'Image' ;
347
+
345
348
/**
346
- * This component handles specifically loading an image source with header
349
+ * This component handles specifically loading an image source with headers
350
+ * default source is never loaded using headers
347
351
*/
348
352
const ImageWithHeaders : ImageComponent = React . forwardRef ( ( props , ref ) => {
349
353
// $FlowIgnore
@@ -391,25 +395,25 @@ const ImageWithHeaders: ImageComponent = React.forwardRef((props, ref) => {
391
395
} ) ;
392
396
393
397
// $FlowIgnore: This is the correct type, but casting makes it unhappy since the variables aren't defined yet
394
- const Image : ImageComponent & ImageStatics = React . forwardRef ( ( props , ref ) => {
395
- if ( props . source && props . source . headers ) {
396
- return < ImageWithHeaders ref = { ref } { ...props } /> ;
397
- }
398
-
399
- return < BaseImage ref = { ref } { ...props } /> ;
400
- } ) ;
398
+ const ImageWithStatics : ImageComponent & ImageStatics = React . forwardRef (
399
+ ( props , ref ) => {
400
+ if ( props . source && props . source . headers ) {
401
+ return < ImageWithHeaders ref = { ref } { ...props } /> ;
402
+ }
401
403
402
- Image . displayName = 'Image' ;
404
+ return < BaseImage ref = { ref } { ...props } /> ;
405
+ }
406
+ ) ;
403
407
404
- Image . getSize = function ( uri , success , failure ) {
408
+ ImageWithStatics . getSize = function ( uri , success , failure ) {
405
409
ImageLoader . getSize ( uri , success , failure ) ;
406
410
} ;
407
411
408
- Image . prefetch = function ( uri ) {
412
+ ImageWithStatics . prefetch = function ( uri ) {
409
413
return ImageLoader . prefetch ( uri ) ;
410
414
} ;
411
415
412
- Image . queryCache = function ( uris ) {
416
+ ImageWithStatics . queryCache = function ( uris ) {
413
417
return ImageLoader . queryCache ( uris ) ;
414
418
} ;
415
419
@@ -465,4 +469,4 @@ const resizeModeStyles = StyleSheet.create({
465
469
}
466
470
} ) ;
467
471
468
- export default Image ;
472
+ export default ImageWithStatics ;
0 commit comments