Skip to content

Commit dc7a41c

Browse files
Nick Lefeverfacebook-github-bot
Nick Lefever
authored andcommitted
Fix NaN value comparison for TextInput component
Summary: See title Changelog: [Internal] Differential Revision: D74915630
1 parent 3f18ae6 commit dc7a41c

File tree

1 file changed

+7
-4
lines changed
  • packages/react-native/ReactCommon/react/renderer/components/textinput/platform/android/react/renderer/components/androidtextinput

1 file changed

+7
-4
lines changed

packages/react-native/ReactCommon/react/renderer/components/textinput/platform/android/react/renderer/components/androidtextinput/AndroidTextInputProps.cpp

+7-4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <react/renderer/components/textinput/baseConversions.h>
1212
#include <react/renderer/core/graphicsConversions.h>
1313
#include <react/renderer/core/propsConversions.h>
14+
#include <react/utils/FloatComparison.h>
1415

1516
namespace facebook::react {
1617

@@ -397,13 +398,15 @@ folly::dynamic AndroidTextInputProps::getDiffProps(
397398
result["adjustsFontSizeToFit"] = paragraphAttributes.adjustsFontSizeToFit;
398399
}
399400

400-
if (paragraphAttributes.minimumFontSize !=
401-
oldProps->paragraphAttributes.minimumFontSize) {
401+
if (!floatEquality(
402+
paragraphAttributes.minimumFontSize,
403+
oldProps->paragraphAttributes.minimumFontSize)) {
402404
result["minimumFontSize"] = paragraphAttributes.minimumFontSize;
403405
}
404406

405-
if (paragraphAttributes.maximumFontSize !=
406-
oldProps->paragraphAttributes.maximumFontSize) {
407+
if (!floatEquality(
408+
paragraphAttributes.maximumFontSize,
409+
oldProps->paragraphAttributes.maximumFontSize)) {
407410
result["maximumFontSize"] = paragraphAttributes.maximumFontSize;
408411
}
409412

0 commit comments

Comments
 (0)