Log ImageSource uris that are not using Facebook domain

Summary:
This diff adds logging to uncover what are the ReactNative screens that are rendering images using NON-Facebook domains

changelog: [internal] internal

Reviewed By: yungsters

Differential Revision: D29179990

fbshipit-source-id: 85f6380848d1ac1461419bc29c4666be389fb87a
This commit is contained in:
David Vacca
2021-06-17 15:11:06 -07:00
committed by Facebook GitHub Bot
parent 6be4f2b2c8
commit 14ca57b435
2 changed files with 21 additions and 3 deletions
+8 -3
View File
@@ -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) {
+13
View File
@@ -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),
};