Skip to content

Commit a0d30b8

Browse files
genkikondofacebook-github-bot
authored andcommitted
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
1 parent 8f7e23a commit a0d30b8

File tree

3 files changed

+4
-22
lines changed

3 files changed

+4
-22
lines changed

Libraries/Text/TextProps.js

+1-7
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,7 @@ export type TextProps = $ReadOnly<{|
6666
* Set hyphenation strategy on Android.
6767
*
6868
*/
69-
android_hyphenationFrequency?: ?(
70-
| 'normal'
71-
| 'none'
72-
| 'full'
73-
| 'high'
74-
| 'balanced'
75-
),
69+
android_hyphenationFrequency?: ?('normal' | 'none' | 'full'),
7670
children?: ?Node,
7771

7872
/**

ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextAnchorViewManager.java

-4
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,6 @@ public void setAndroidHyphenationFrequency(ReactTextView view, @Nullable String
110110
view.setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_NONE);
111111
} else if (frequency.equals("full")) {
112112
view.setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_FULL);
113-
} else if (frequency.equals("balanced")) {
114-
view.setHyphenationFrequency(Layout.BREAK_STRATEGY_BALANCED);
115-
} else if (frequency.equals("high")) {
116-
view.setHyphenationFrequency(Layout.BREAK_STRATEGY_HIGH_QUALITY);
117113
} else if (frequency.equals("normal")) {
118114
view.setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_NORMAL);
119115
} else {

packages/rn-tester/js/examples/Text/TextExample.android.js

+3-11
Original file line numberDiff line numberDiff line change
@@ -216,23 +216,15 @@ class TextExample extends React.Component<{...}> {
216216
<RNTesterBlock title="Hyphenation">
217217
<Text android_hyphenationFrequency="normal">
218218
<Text style={{color: 'red'}}>Normal: </Text>
219-
WillHaveAnHyphenWhenBreakingForNewLine
219+
WillHaveAHyphenWhenBreakingForNewLine
220220
</Text>
221221
<Text android_hyphenationFrequency="none">
222222
<Text style={{color: 'red'}}>None: </Text>
223-
WillNotHaveAnHyphenWhenBreakingForNewLine
223+
WillNotHaveAHyphenWhenBreakingForNewLine
224224
</Text>
225225
<Text android_hyphenationFrequency="full">
226226
<Text style={{color: 'red'}}>Full: </Text>
227-
WillHaveAnHyphenWhenBreakingForNewLine
228-
</Text>
229-
<Text android_hyphenationFrequency="high">
230-
<Text style={{color: 'red'}}>High: </Text>
231-
WillHaveAnHyphenWhenBreakingForNewLine
232-
</Text>
233-
<Text android_hyphenationFrequency="balanced">
234-
<Text style={{color: 'red'}}>Balanced: </Text>
235-
WillHaveAnHyphenWhenBreakingForNewLine
227+
WillHaveAHyphenWhenBreakingForNewLine
236228
</Text>
237229
</RNTesterBlock>
238230
<RNTesterBlock title="Padding">

0 commit comments

Comments
 (0)