Skip to content

Commit 14ca57b

Browse files
mdvaccafacebook-github-bot
authored andcommitted
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
1 parent 6be4f2b commit 14ca57b

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

Libraries/Image/Image.android.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import ImageViewNativeComponent from './ImageViewNativeComponent';
1313
import * as React from 'react';
1414
import StyleSheet from '../StyleSheet/StyleSheet';
1515
import TextAncestor from '../Text/TextAncestor';
16-
16+
import ImageSourceInjection from './ImageSourceInjection';
1717
import ImageAnalyticsTagContext from './ImageAnalyticsTagContext';
1818
import flattenStyle from '../StyleSheet/flattenStyle';
1919
import resolveAssetSource from './resolveAssetSource';
@@ -132,8 +132,13 @@ let Image = (props: ImagePropsType, forwardedRef) => {
132132
props.loadingIndicatorSource,
133133
);
134134

135-
if (source && source.uri === '') {
136-
console.warn('source.uri should not be an empty string');
135+
if (source) {
136+
const uri = source.uri;
137+
if (uri === '') {
138+
console.warn('source.uri should not be an empty string');
139+
} else if (ImageSourceInjection.unstable_enableUriAnalytics) {
140+
ImageSourceInjection.unstable_enableUriAnalytics(uri);
141+
}
137142
}
138143

139144
if (props.src) {
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* Copyright (c) Facebook, Inc. and its affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @format
8+
* @flow strict
9+
*/
10+
11+
export default {
12+
unstable_enableUriAnalytics: (null: ?(uri: string) => void),
13+
};

0 commit comments

Comments
 (0)