@@ -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 )
@@ -343,7 +344,8 @@ const BaseImage: ImageComponent = React.forwardRef((props, ref) => {
343
344
} ) ;
344
345
345
346
/**
346
- * This component handles specifically loading an image source with header
347
+ * This component handles specifically loading an image source with headers
348
+ * default source is never loaded using headers
347
349
*/
348
350
const ImageWithHeaders : ImageComponent = React . forwardRef ( ( props , ref ) => {
349
351
// $FlowIgnore
@@ -391,25 +393,27 @@ const ImageWithHeaders: ImageComponent = React.forwardRef((props, ref) => {
391
393
} ) ;
392
394
393
395
// $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
- }
396
+ const ImageWithStatics : ImageComponent & ImageStatics = React . forwardRef (
397
+ ( props , ref ) => {
398
+ if ( props . source && props . source . headers ) {
399
+ return < ImageWithHeaders ref = { ref } { ...props } /> ;
400
+ }
398
401
399
- return < BaseImage ref = { ref } { ...props } /> ;
400
- } ) ;
402
+ return < BaseImage ref = { ref } { ...props } /> ;
403
+ }
404
+ ) ;
401
405
402
- Image . displayName = 'Image' ;
406
+ ImageWithStatics . displayName = 'Image' ;
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