diff --git a/Libraries/Image/Image.ios.js b/Libraries/Image/Image.ios.js
index 22b28309076ee1..e5ff46e73827bf 100644
--- a/Libraries/Image/Image.ios.js
+++ b/Libraries/Image/Image.ios.js
@@ -15,6 +15,7 @@ const React = require('react');
const ReactNative = require('../Renderer/shims/ReactNative'); // eslint-disable-line no-unused-vars
const StyleSheet = require('../StyleSheet/StyleSheet');
+const ImageAnalyticsTagContext = require('./ImageAnalyticsTagContext').default;
const flattenStyle = require('../StyleSheet/flattenStyle');
const resolveAssetSource = require('./resolveAssetSource');
@@ -124,14 +125,21 @@ let Image = (props: ImagePropsType, forwardedRef) => {
}
return (
-
+
+ {analyticTag => {
+ return (
+
+ );
+ }}
+
);
};
diff --git a/Libraries/Image/RCTImageURLLoaderWithAttribution.h b/Libraries/Image/RCTImageURLLoaderWithAttribution.h
index d7632746346a44..444366d1e57e80 100644
--- a/Libraries/Image/RCTImageURLLoaderWithAttribution.h
+++ b/Libraries/Image/RCTImageURLLoaderWithAttribution.h
@@ -15,6 +15,7 @@ namespace react {
struct ImageURLLoaderAttribution {
int32_t nativeViewTag = 0;
int32_t surfaceId = 0;
+ NSString *analyticTag;
};
} // namespace react
diff --git a/Libraries/Image/RCTImageView.h b/Libraries/Image/RCTImageView.h
index 4b2fe37637e618..c895a538e4da0e 100644
--- a/Libraries/Image/RCTImageView.h
+++ b/Libraries/Image/RCTImageView.h
@@ -22,5 +22,6 @@
@property (nonatomic, copy) NSArray *imageSources;
@property (nonatomic, assign) CGFloat blurRadius;
@property (nonatomic, assign) RCTResizeMode resizeMode;
+@property (nonatomic, copy) NSString *internal_analyticTag;
@end
diff --git a/Libraries/Image/RCTImageView.mm b/Libraries/Image/RCTImageView.mm
index 11a0d7838e915d..532b42c0e9a3a4 100644
--- a/Libraries/Image/RCTImageView.mm
+++ b/Libraries/Image/RCTImageView.mm
@@ -216,6 +216,13 @@ - (void)setResizeMode:(RCTResizeMode)resizeMode
}
}
+- (void)setInternal_analyticTag:(NSString *)internal_analyticTag {
+ if (_internal_analyticTag != internal_analyticTag) {
+ _internal_analyticTag = internal_analyticTag;
+ _needsReload = YES;
+ }
+}
+
- (void)cancelImageLoad
{
[_loaderRequest cancel];
@@ -341,6 +348,7 @@ - (void)reloadImage
attribution:{
.nativeViewTag = [self.reactTag intValue],
.surfaceId = [self.rootTag intValue],
+ .analyticTag = self.internal_analyticTag
}
progressBlock:progressHandler
partialLoadBlock:partialLoadHandler
diff --git a/Libraries/Image/RCTImageViewManager.mm b/Libraries/Image/RCTImageViewManager.mm
index 864184e9130f40..8a06a4b42d1552 100644
--- a/Libraries/Image/RCTImageViewManager.mm
+++ b/Libraries/Image/RCTImageViewManager.mm
@@ -40,6 +40,7 @@ - (UIView *)view
RCT_EXPORT_VIEW_PROPERTY(onLoad, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onLoadEnd, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(resizeMode, RCTResizeMode)
+RCT_EXPORT_VIEW_PROPERTY(internal_analyticTag, NSString)
RCT_REMAP_VIEW_PROPERTY(source, imageSources, NSArray);
RCT_CUSTOM_VIEW_PROPERTY(tintColor, UIColor, RCTImageView)
{
diff --git a/Libraries/Image/__tests__/__snapshots__/Image-test.js.snap b/Libraries/Image/__tests__/__snapshots__/Image-test.js.snap
index 1bcd31396ff7d4..ddb928125e2145 100644
--- a/Libraries/Image/__tests__/__snapshots__/Image-test.js.snap
+++ b/Libraries/Image/__tests__/__snapshots__/Image-test.js.snap
@@ -12,6 +12,7 @@ exports[` should render as when mocked 1`] = `
exports[` should render as when not mocked 1`] = `