From ba7fca8cbdad3f6b76d99762d8cba1a6ed6ed557 Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Mon, 23 Sep 2024 17:52:30 -0700 Subject: [PATCH] Fix measuring text with incorrect hyphenationFrequency Summary: A typo means TextLayoutManager will incorrectly measure text as if `LineBreaker.HYPHENATION_FREQUENCY_NORMAL` is set, instead of the correct default of `LineBreaker.HYPHENATION_FREQUENCY_NONE` which we use to display the `TextView`. This causes truncation if hyphenation would have caused text to be shorter than if not hyphenated. Fix the typo. Changelog: [Android][Fixed] - Fix measuring text with incorrect hyphenationFrequency Reviewed By: mellyeliu Differential Revision: D63293027 fbshipit-source-id: baaf2ae2676548cf0815ae96e324af273be6f99e --- .../java/com/facebook/react/views/text/TextLayoutManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.java index 706b77825eb..0c4e4351be2 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.java @@ -446,7 +446,7 @@ public class TextLayoutManager { ? paragraphAttributes.getBoolean(PA_KEY_INCLUDE_FONT_PADDING) : DEFAULT_INCLUDE_FONT_PADDING; int hyphenationFrequency = - TextAttributeProps.getTextBreakStrategy( + TextAttributeProps.getHyphenationFrequency( paragraphAttributes.getString(PA_KEY_HYPHENATION_FREQUENCY)); boolean adjustFontSizeToFit = paragraphAttributes.contains(PA_KEY_ADJUST_FONT_SIZE_TO_FIT)