diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricMountingManager.cpp b/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricMountingManager.cpp index f57db161091..55f6fe2ab44 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricMountingManager.cpp +++ b/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricMountingManager.cpp @@ -227,7 +227,8 @@ jni::local_ref getProps( strcmp(newShadowView.componentName, "Image") == 0 || strcmp(newShadowView.componentName, "ScrollView") == 0 || strcmp(newShadowView.componentName, "RawText") == 0 || - strcmp(newShadowView.componentName, "Text") == 0)) { + strcmp(newShadowView.componentName, "Text") == 0 || + strcmp(newShadowView.componentName, "Paragraph") == 0)) { return ReadableNativeMap::newObjectCxxArgs( newProps->getDiffProps(oldProps)); } diff --git a/packages/react-native/ReactCommon/react/renderer/components/text/ParagraphProps.cpp b/packages/react-native/ReactCommon/react/renderer/components/text/ParagraphProps.cpp index a483643ebdc..1e2473a766c 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/text/ParagraphProps.cpp +++ b/packages/react-native/ReactCommon/react/renderer/components/text/ParagraphProps.cpp @@ -152,4 +152,76 @@ SharedDebugStringConvertibleList ParagraphProps::getDebugProps() const { } #endif +#ifdef ANDROID + +folly::dynamic ParagraphProps::getDiffProps(const Props* prevProps) const { + static const auto defaultProps = ParagraphProps(); + + const ParagraphProps* oldProps = prevProps == nullptr + ? &defaultProps + : static_cast(prevProps); + + folly::dynamic result = ViewProps::getDiffProps(oldProps); + + BaseTextProps::appendTextAttributesProps(result, oldProps); + + if (paragraphAttributes.maximumNumberOfLines != + oldProps->paragraphAttributes.maximumNumberOfLines) { + result["numberOfLine"] = paragraphAttributes.maximumNumberOfLines; + } + + if (paragraphAttributes.ellipsizeMode != + oldProps->paragraphAttributes.ellipsizeMode) { + result["ellipsizeMode"] = toString(paragraphAttributes.ellipsizeMode); + } + + if (paragraphAttributes.textBreakStrategy != + oldProps->paragraphAttributes.textBreakStrategy) { + result["textBreakStrategy"] = + toString(paragraphAttributes.textBreakStrategy); + } + + if (paragraphAttributes.adjustsFontSizeToFit != + oldProps->paragraphAttributes.adjustsFontSizeToFit) { + result["adjustsFontSizeToFit"] = paragraphAttributes.adjustsFontSizeToFit; + } + + if (paragraphAttributes.minimumFontScale != + oldProps->paragraphAttributes.minimumFontScale) { + result["minimumFontScale"] = paragraphAttributes.minimumFontScale; + } + + if (paragraphAttributes.minimumFontSize != + oldProps->paragraphAttributes.minimumFontSize) { + result["minimumFontSize"] = paragraphAttributes.minimumFontSize; + } + + if (paragraphAttributes.maximumFontSize != + oldProps->paragraphAttributes.maximumFontSize) { + result["maximumFontSize"] = paragraphAttributes.maximumFontSize; + } + + if (paragraphAttributes.includeFontPadding != + oldProps->paragraphAttributes.includeFontPadding) { + result["includeFontPadding"] = paragraphAttributes.includeFontPadding; + } + + if (paragraphAttributes.android_hyphenationFrequency != + oldProps->paragraphAttributes.android_hyphenationFrequency) { + result["android_hyphenationFrequency"] = + toString(paragraphAttributes.android_hyphenationFrequency); + } + + if (isSelectable != oldProps->isSelectable) { + result["selectable"] = isSelectable; + } + + if (onTextLayout != oldProps->onTextLayout) { + result["onTextLayout"] = onTextLayout; + } + + return result; +} + +#endif } // namespace facebook::react diff --git a/packages/react-native/ReactCommon/react/renderer/components/text/ParagraphProps.h b/packages/react-native/ReactCommon/react/renderer/components/text/ParagraphProps.h index 6640fca0344..8af1ad240e5 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/text/ParagraphProps.h +++ b/packages/react-native/ReactCommon/react/renderer/components/text/ParagraphProps.h @@ -57,6 +57,12 @@ class ParagraphProps : public ViewProps, public BaseTextProps { #if RN_DEBUG_STRING_CONVERTIBLE SharedDebugStringConvertibleList getDebugProps() const override; #endif + +#ifdef ANDROID + + folly::dynamic getDiffProps(const Props* prevProps) const override; + +#endif }; } // namespace facebook::react