diff --git a/Libraries/Image/Image.android.js b/Libraries/Image/Image.android.js index 76d3f56306..e878ad5dbe 100644 --- a/Libraries/Image/Image.android.js +++ b/Libraries/Image/Image.android.js @@ -13,7 +13,7 @@ import ImageViewNativeComponent from './ImageViewNativeComponent'; import * as React from 'react'; import StyleSheet from '../StyleSheet/StyleSheet'; import TextAncestor from '../Text/TextAncestor'; -import ImageSourceInjection from './ImageSourceInjection'; +import ImageInjection from './ImageInjection'; import ImageAnalyticsTagContext from './ImageAnalyticsTagContext'; import flattenStyle from '../StyleSheet/flattenStyle'; import resolveAssetSource from './resolveAssetSource'; @@ -136,8 +136,6 @@ let Image = (props: ImagePropsType, forwardedRef) => { const uri = source.uri; if (uri === '') { console.warn('source.uri should not be an empty string'); - } else if (ImageSourceInjection.unstable_enableUriAnalytics) { - ImageSourceInjection.unstable_enableUriAnalytics(uri); } } @@ -222,6 +220,10 @@ Image = React.forwardRef< | React.ElementRef, >(Image); +if (ImageInjection.unstable_createImageComponent != null) { + Image = ImageInjection.unstable_createImageComponent(Image); +} + Image.displayName = 'Image'; /** diff --git a/Libraries/Image/ImageInjection.js b/Libraries/Image/ImageInjection.js new file mode 100644 index 0000000000..43723fa375 --- /dev/null +++ b/Libraries/Image/ImageInjection.js @@ -0,0 +1,28 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format strict-local + * @flow + */ + +import * as React from 'react'; +import type {ImageProps as ImagePropsType} from './ImageProps'; +import ImageViewNativeComponent from './ImageViewNativeComponent'; +import TextInlineImageNativeComponent from './TextInlineImageNativeComponent'; + +export default { + unstable_createImageComponent: (null: ?( + Image: React.AbstractComponent< + ImagePropsType, + | React.ElementRef + | React.ElementRef, + >, + ) => React.AbstractComponent< + ImagePropsType, + | React.ElementRef + | React.ElementRef, + >), +}; diff --git a/Libraries/Image/ImageSourceInjection.js b/Libraries/Image/ImageSourceInjection.js deleted file mode 100644 index ff8fa422aa..0000000000 --- a/Libraries/Image/ImageSourceInjection.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict - */ - -export default { - unstable_enableUriAnalytics: (null: ?(uri: string) => void), -};