diff --git a/Libraries/Image/Image.android.js b/Libraries/Image/Image.android.js index 81df06415c1..76d3f56306d 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 ImageAnalyticsTagContext from './ImageAnalyticsTagContext'; import flattenStyle from '../StyleSheet/flattenStyle'; import resolveAssetSource from './resolveAssetSource'; @@ -132,8 +132,13 @@ let Image = (props: ImagePropsType, forwardedRef) => { props.loadingIndicatorSource, ); - if (source && source.uri === '') { - console.warn('source.uri should not be an empty string'); + if (source) { + 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); + } } if (props.src) { diff --git a/Libraries/Image/ImageSourceInjection.js b/Libraries/Image/ImageSourceInjection.js new file mode 100644 index 00000000000..ff8fa422aa9 --- /dev/null +++ b/Libraries/Image/ImageSourceInjection.js @@ -0,0 +1,13 @@ +/** + * 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), +};