@@ -157,6 +157,7 @@ function raiseOnErrorEvent(uri, { onError, onLoadEnd }) {
157157 }
158158 if ( onLoadEnd ) onLoadEnd ( ) ;
159159}
160+
160161function hasSourceDiff ( a : ImageSource , b : ImageSource ) {
161162 return (
162163 a . uri !== b . uri || JSON . stringify ( a . headers ) !== JSON . stringify ( b . headers )
@@ -342,8 +343,11 @@ const BaseImage: ImageComponent = React.forwardRef((props, ref) => {
342343 ) ;
343344} ) ;
344345
346+ BaseImage . displayName = 'Image' ;
347+
345348/**
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
347351 */
348352const ImageWithHeaders : ImageComponent = React . forwardRef ( ( props , ref ) => {
349353 // $FlowIgnore
@@ -391,25 +395,25 @@ const ImageWithHeaders: ImageComponent = React.forwardRef((props, ref) => {
391395} ) ;
392396
393397// $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+ }
401403
402- Image . displayName = 'Image' ;
404+ return < BaseImage ref = { ref } { ...props } /> ;
405+ }
406+ ) ;
403407
404- Image . getSize = function ( uri , success , failure ) {
408+ ImageWithStatics . getSize = function ( uri , success , failure ) {
405409 ImageLoader . getSize ( uri , success , failure ) ;
406410} ;
407411
408- Image . prefetch = function ( uri ) {
412+ ImageWithStatics . prefetch = function ( uri ) {
409413 return ImageLoader . prefetch ( uri ) ;
410414} ;
411415
412- Image . queryCache = function ( uris ) {
416+ ImageWithStatics . queryCache = function ( uris ) {
413417 return ImageLoader . queryCache ( uris ) ;
414418} ;
415419
@@ -465,4 +469,4 @@ const resizeModeStyles = StyleSheet.create({
465469 }
466470} ) ;
467471
468- export default Image ;
472+ export default ImageWithStatics ;
0 commit comments