diff --git a/packages/react-native/ReactCommon/react/renderer/components/text/BaseTextProps.cpp b/packages/react-native/ReactCommon/react/renderer/components/text/BaseTextProps.cpp index cb316c9ec1c..3f762caeea4 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/text/BaseTextProps.cpp +++ b/packages/react-native/ReactCommon/react/renderer/components/text/BaseTextProps.cpp @@ -12,6 +12,7 @@ #include #include #include +#include namespace facebook::react { @@ -377,12 +378,14 @@ void BaseTextProps::appendTextAttributesProps( result["fontFamily"] = textAttributes.fontFamily; } - if (textAttributes.fontSize != oldProps->textAttributes.fontSize) { + if (!floatEquality( + textAttributes.fontSize, oldProps->textAttributes.fontSize)) { result["fontSize"] = textAttributes.fontSize; } - if (textAttributes.fontSizeMultiplier != - oldProps->textAttributes.fontSizeMultiplier) { + if (!floatEquality( + textAttributes.fontSizeMultiplier, + oldProps->textAttributes.fontSizeMultiplier)) { result["fontSizeMultiplier"] = textAttributes.fontSizeMultiplier; } @@ -411,8 +414,9 @@ void BaseTextProps::appendTextAttributesProps( : folly::dynamic(nullptr); } - if (textAttributes.maxFontSizeMultiplier != - oldProps->textAttributes.maxFontSizeMultiplier) { + if (!floatEquality( + textAttributes.maxFontSizeMultiplier, + oldProps->textAttributes.maxFontSizeMultiplier)) { result["maxFontSizeMultiplier"] = textAttributes.maxFontSizeMultiplier; } @@ -423,7 +427,9 @@ void BaseTextProps::appendTextAttributesProps( : nullptr; } - if (textAttributes.letterSpacing != oldProps->textAttributes.letterSpacing) { + if (!floatEquality( + textAttributes.letterSpacing, + oldProps->textAttributes.letterSpacing)) { result["letterSpacing"] = textAttributes.letterSpacing; } @@ -440,7 +446,8 @@ void BaseTextProps::appendTextAttributesProps( : nullptr; } - if (textAttributes.lineHeight != oldProps->textAttributes.lineHeight) { + if (!floatEquality( + textAttributes.lineHeight, oldProps->textAttributes.lineHeight)) { result["lineHeight"] = textAttributes.lineHeight; } @@ -500,8 +507,9 @@ void BaseTextProps::appendTextAttributesProps( : nullptr; } - if (textAttributes.textShadowRadius != - oldProps->textAttributes.textShadowRadius) { + if (!floatEquality( + textAttributes.textShadowRadius, + oldProps->textAttributes.textShadowRadius)) { result["textShadowRadius"] = textAttributes.textShadowRadius; }