Skip to content

Commit 652db8a

Browse files
dmytrorykunfacebook-github-bot
authored andcommitted
Fix C++ prop type for the Image.defaultSource (facebook#47713)
Summary: `defaultSource` is defined as a single `ImageSource` in docs (https://reactnative.dev/docs/next/image#defaultsource) but its type is a vector of `ImageSource`s in `ImageProps.h`. This diff changes its C++ type to just `ImageSource`. Technically, this is a breaking change, however I don't think folks should directly access `ImageProps` outside of `RCTImageComponentView.mm` Moreover, this prop is actually not implemented in Fabric, so this change should have no practical effect. Changelog: [Internal] Facebook T208171435 - [RN][Fabric][iOS] Implement defaultSource support for Image Reviewed By: javache Differential Revision: D65821570
1 parent fc02528 commit 652db8a

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ ImageProps::ImageProps(
2626
"source",
2727
sourceProps.sources,
2828
{})),
29-
defaultSources(
29+
defaultSource(
3030
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
31-
? sourceProps.defaultSources
31+
? sourceProps.defaultSource
3232
: convertRawProp(
3333
context,
3434
rawProps,
3535
"defaultSource",
36-
sourceProps.defaultSources,
36+
sourceProps.defaultSource,
3737
{})),
3838
resizeMode(
3939
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
@@ -95,7 +95,7 @@ void ImageProps::setProp(
9595

9696
switch (hash) {
9797
RAW_SET_PROP_SWITCH_CASE(sources, "source");
98-
RAW_SET_PROP_SWITCH_CASE(defaultSources, "defaultSource");
98+
RAW_SET_PROP_SWITCH_CASE(defaultSource, "defaultSource");
9999
RAW_SET_PROP_SWITCH_CASE_BASIC(resizeMode);
100100
RAW_SET_PROP_SWITCH_CASE_BASIC(blurRadius);
101101
RAW_SET_PROP_SWITCH_CASE_BASIC(capInsets);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class ImageProps final : public ViewProps {
3232
#pragma mark - Props
3333

3434
ImageSources sources{};
35-
ImageSources defaultSources{};
35+
ImageSource defaultSource{};
3636
ImageResizeMode resizeMode{ImageResizeMode::Stretch};
3737
Float blurRadius{};
3838
EdgeInsets capInsets{};

0 commit comments

Comments
 (0)