diff --git a/packages/react-native/ReactCommon/react/renderer/components/text/platform/android/react/renderer/components/text/HostPlatformParagraphProps.cpp b/packages/react-native/ReactCommon/react/renderer/components/text/platform/android/react/renderer/components/text/HostPlatformParagraphProps.cpp index f2664d7aa96..4f151bf069a 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/text/platform/android/react/renderer/components/text/HostPlatformParagraphProps.cpp +++ b/packages/react-native/ReactCommon/react/renderer/components/text/platform/android/react/renderer/components/text/HostPlatformParagraphProps.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -30,7 +31,16 @@ HostPlatformParagraphProps::HostPlatformParagraphProps( rawProps, "disabled", sourceProps.disabled, - false)){}; + false)), + selectionColor( + ReactNativeFeatureFlags::enableCppPropsIteratorSetter() + ? sourceProps.selectionColor + : convertRawProp( + context, + rawProps, + "selectionColor", + sourceProps.selectionColor, + {})){}; void HostPlatformParagraphProps::setProp( const PropsParserContext& context, @@ -44,7 +54,10 @@ void HostPlatformParagraphProps::setProp( static auto defaults = HostPlatformParagraphProps{}; - switch (hash) { RAW_SET_PROP_SWITCH_CASE_BASIC(disabled); } + switch (hash) { + RAW_SET_PROP_SWITCH_CASE_BASIC(disabled); + RAW_SET_PROP_SWITCH_CASE_BASIC(selectionColor); + } } #pragma mark - DebugStringConvertible @@ -54,7 +67,8 @@ SharedDebugStringConvertibleList HostPlatformParagraphProps::getDebugProps() const { return BaseParagraphProps::getDebugProps() + SharedDebugStringConvertibleList{ - debugStringConvertibleItem("disabled", disabled)}; + debugStringConvertibleItem("disabled", disabled), + debugStringConvertibleItem("selectionColor", selectionColor)}; } #endif @@ -147,6 +161,14 @@ folly::dynamic HostPlatformParagraphProps::getDiffProps( result["disabled"] = disabled; } + if (selectionColor != oldProps->selectionColor) { + if (selectionColor.has_value()) { + result["selectionColor"] = *selectionColor.value(); + } else { + result["selectionColor"] = folly::dynamic(nullptr); + } + } + return result; } diff --git a/packages/react-native/ReactCommon/react/renderer/components/text/platform/android/react/renderer/components/text/HostPlatformParagraphProps.h b/packages/react-native/ReactCommon/react/renderer/components/text/platform/android/react/renderer/components/text/HostPlatformParagraphProps.h index 1f860860100..cc25bfc83a5 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/text/platform/android/react/renderer/components/text/HostPlatformParagraphProps.h +++ b/packages/react-native/ReactCommon/react/renderer/components/text/platform/android/react/renderer/components/text/HostPlatformParagraphProps.h @@ -9,10 +9,12 @@ #include #include +#include #include #include #include +#include namespace facebook::react { @@ -38,6 +40,7 @@ class HostPlatformParagraphProps : public BaseParagraphProps { #pragma mark - Props bool disabled{false}; + std::optional selectionColor{}; #pragma mark - DebugStringConvertible