Skip to content

Commit dc36a10

Browse files
dmytrorykunfacebook-github-bot
authored andcommitted
[skip ci] Add missing Android-only props to ImageProps (#47719)
Summary: There is a subset of `ImageProps` that are used by Android but not used by iOS. They were missing in the `ImageProps.h`. It was fine when they were only consumed by the Android mounting layer. But it becomes a problem if we want to write some shared C++ code based on those props. This diff adds those props to the corresponding C++ type. This should have no practical effect for both platforms. Changelog: [Internal] Reviewed By: javache Differential Revision: D65426569
1 parent c4f81e0 commit dc36a10

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed

packages/react-native/ReactCommon/react/renderer/components/image/ImageProps.cpp

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ ImageProps::ImageProps(
3535
"defaultSource",
3636
sourceProps.defaultSource,
3737
{})),
38+
loadingIndicatorSource(
39+
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
40+
? sourceProps.loadingIndicatorSource
41+
: convertRawProp(
42+
context,
43+
rawProps,
44+
"loadingIndicatorSource",
45+
sourceProps.loadingIndicatorSource,
46+
{})),
3847
resizeMode(
3948
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
4049
? sourceProps.resizeMode
@@ -79,6 +88,60 @@ ImageProps::ImageProps(
7988
rawProps,
8089
"internal_analyticTag",
8190
sourceProps.internal_analyticTag,
91+
{})),
92+
resizeMethod(
93+
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
94+
? sourceProps.internal_analyticTag
95+
: convertRawProp(
96+
context,
97+
rawProps,
98+
"resizeMethod",
99+
sourceProps.internal_analyticTag,
100+
{})),
101+
resizeMultiplier(
102+
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
103+
? sourceProps.resizeMultiplier
104+
: convertRawProp(
105+
context,
106+
rawProps,
107+
"resizeMultiplier",
108+
sourceProps.resizeMultiplier,
109+
{})),
110+
shouldNotify(
111+
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
112+
? sourceProps.shouldNotify
113+
: convertRawProp(
114+
context,
115+
rawProps,
116+
"shouldNotify",
117+
sourceProps.shouldNotify,
118+
{})),
119+
overlayColor(
120+
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
121+
? sourceProps.overlayColor
122+
: convertRawProp(
123+
context,
124+
rawProps,
125+
"overlayColor",
126+
sourceProps.overlayColor,
127+
{})),
128+
fadeDuration(
129+
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
130+
? sourceProps.fadeDuration
131+
: convertRawProp(
132+
context,
133+
rawProps,
134+
"fadeDuration",
135+
sourceProps.fadeDuration,
136+
{})),
137+
progressiveRenderingEnabled(
138+
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
139+
? sourceProps.progressiveRenderingEnabled
140+
: convertRawProp(
141+
context,
142+
rawProps,
143+
"progressiveRenderingEnabled",
144+
sourceProps.progressiveRenderingEnabled,
82145
{})) {}
83146

84147
void ImageProps::setProp(
@@ -96,11 +159,18 @@ void ImageProps::setProp(
96159
switch (hash) {
97160
RAW_SET_PROP_SWITCH_CASE(sources, "source");
98161
RAW_SET_PROP_SWITCH_CASE(defaultSource, "defaultSource");
162+
RAW_SET_PROP_SWITCH_CASE(loadingIndicatorSource, "loadingIndicatorSource");
99163
RAW_SET_PROP_SWITCH_CASE_BASIC(resizeMode);
100164
RAW_SET_PROP_SWITCH_CASE_BASIC(blurRadius);
101165
RAW_SET_PROP_SWITCH_CASE_BASIC(capInsets);
102166
RAW_SET_PROP_SWITCH_CASE_BASIC(tintColor);
103167
RAW_SET_PROP_SWITCH_CASE_BASIC(internal_analyticTag);
168+
RAW_SET_PROP_SWITCH_CASE_BASIC(resizeMethod);
169+
RAW_SET_PROP_SWITCH_CASE_BASIC(resizeMultiplier);
170+
RAW_SET_PROP_SWITCH_CASE_BASIC(shouldNotify);
171+
RAW_SET_PROP_SWITCH_CASE_BASIC(overlayColor);
172+
RAW_SET_PROP_SWITCH_CASE_BASIC(fadeDuration);
173+
RAW_SET_PROP_SWITCH_CASE_BASIC(progressiveRenderingEnabled);
104174
}
105175
}
106176

packages/react-native/ReactCommon/react/renderer/components/image/ImageProps.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,18 @@ class ImageProps final : public ViewProps {
3333

3434
ImageSources sources{};
3535
ImageSource defaultSource{};
36+
ImageSource loadingIndicatorSource{};
3637
ImageResizeMode resizeMode{ImageResizeMode::Stretch};
3738
Float blurRadius{};
3839
EdgeInsets capInsets{};
3940
SharedColor tintColor{};
4041
std::string internal_analyticTag{};
42+
std::string resizeMethod{};
43+
Float resizeMultiplier{};
44+
bool shouldNotify{};
45+
SharedColor overlayColor{};
46+
Float fadeDuration{};
47+
bool progressiveRenderingEnabled{};
4148
};
4249

4350
} // namespace facebook::react

0 commit comments

Comments
 (0)