From a0d30b848a07480d0fccec608a62a505c71f8cac Mon Sep 17 00:00:00 2001 From: Genki Kondo Date: Thu, 26 Aug 2021 10:38:36 -0700 Subject: [PATCH] Remove unsupported values for android_hyphenationFrequency Summary: hyphenationStrategy must be one of one of Layout#HYPHENATION_FREQUENCY_NONE, Layout#HYPHENATION_FREQUENCY_NORMAL, Layout#HYPHENATION_FREQUENCY_FULL: (https://developer.android.com/reference/android/widget/TextView#setHyphenationFrequency(int)) Thus "high" and "balanced" are not only redundant, but actually don't do what the value indicates - Layout#BREAK_STRATEGY_BALANCED (constant value: 2) and Layout#BREAK_STRATEGY_HIGH_QUALITY (constant value: 1) are only meant to be used for android:breakStrategy Changelog: [Android][Changed] - Remove `"high"` and `"balanced"` as values for `android_hyphenationFrequency` on `Text` Reviewed By: JoshuaGross Differential Revision: D30531096 fbshipit-source-id: 1a0b6e733bb21ce6b2f104a2025a79c16de3cfea --- Libraries/Text/TextProps.js | 8 +------- .../views/text/ReactTextAnchorViewManager.java | 4 ---- .../js/examples/Text/TextExample.android.js | 14 +++----------- 3 files changed, 4 insertions(+), 22 deletions(-) diff --git a/Libraries/Text/TextProps.js b/Libraries/Text/TextProps.js index b2a39e58df768e..3942a5998cd343 100644 --- a/Libraries/Text/TextProps.js +++ b/Libraries/Text/TextProps.js @@ -66,13 +66,7 @@ export type TextProps = $ReadOnly<{| * Set hyphenation strategy on Android. * */ - android_hyphenationFrequency?: ?( - | 'normal' - | 'none' - | 'full' - | 'high' - | 'balanced' - ), + android_hyphenationFrequency?: ?('normal' | 'none' | 'full'), children?: ?Node, /** diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextAnchorViewManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextAnchorViewManager.java index ffc8655c0a47c1..6ee067cb661a58 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextAnchorViewManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextAnchorViewManager.java @@ -110,10 +110,6 @@ public void setAndroidHyphenationFrequency(ReactTextView view, @Nullable String view.setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_NONE); } else if (frequency.equals("full")) { view.setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_FULL); - } else if (frequency.equals("balanced")) { - view.setHyphenationFrequency(Layout.BREAK_STRATEGY_BALANCED); - } else if (frequency.equals("high")) { - view.setHyphenationFrequency(Layout.BREAK_STRATEGY_HIGH_QUALITY); } else if (frequency.equals("normal")) { view.setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_NORMAL); } else { diff --git a/packages/rn-tester/js/examples/Text/TextExample.android.js b/packages/rn-tester/js/examples/Text/TextExample.android.js index 6b3668663d8266..d44aff22b4297e 100644 --- a/packages/rn-tester/js/examples/Text/TextExample.android.js +++ b/packages/rn-tester/js/examples/Text/TextExample.android.js @@ -216,23 +216,15 @@ class TextExample extends React.Component<{...}> { Normal: - WillHaveAnHyphenWhenBreakingForNewLine + WillHaveAHyphenWhenBreakingForNewLine None: - WillNotHaveAnHyphenWhenBreakingForNewLine + WillNotHaveAHyphenWhenBreakingForNewLine Full: - WillHaveAnHyphenWhenBreakingForNewLine - - - High: - WillHaveAnHyphenWhenBreakingForNewLine - - - Balanced: - WillHaveAnHyphenWhenBreakingForNewLine + WillHaveAHyphenWhenBreakingForNewLine