You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit d4fff24
Browse filesBrowse the repository at this point in the historyBrowse files
Add android_lineBreakStyle and android_lineBreakWordStyle to Text
Android 13 (API 33) added LineBreakConfig, which selects the
strictness of the line-breaking rules (CSS `line-break`: loose,
normal, strict) and phrase-based breaking for Japanese (CSS
`word-break: auto-phrase`). React Native measures and draws Text with
a StaticLayout it builds itself, so neither setting can be reached from
outside: a native module could only change the drawn TextView, which
would then disagree with the height Yoga measured.
Add two Android-only paragraph props, plumbed the same way as
android_hyphenationFrequency:
- android_lineBreakStyle: 'none' | 'loose' | 'normal' | 'strict'
- android_lineBreakWordStyle: 'none' | 'phrase'
They go into ParagraphAttributes and the paragraph MapBuffer, are
applied to the StaticLayout.Builder in TextLayoutManager (measurement
and the prepared layout), and to ReactTextView through @ReactProp
setters (drawing). Both are ignored below API 33. When both are
'none' (the default) no LineBreakConfig is set, so existing text lays
out exactly as before.
TextInput is left out: it does not list the props in its view config.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: packages/react-native/ReactAndroid/src/test/java/com/facebook/react/views/text/TextLayoutManagerAbsoluteLayoutWithFractionalPixelTest.kt
+5Lines changed: 5 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,7 @@
8
8
packagecom.facebook.react.views.text
9
9
10
10
importandroid.annotation.SuppressLint
11
+
importandroid.graphics.text.LineBreakConfig
11
12
importandroid.text.BoringLayout
12
13
importandroid.text.Layout
13
14
importandroid.text.SpannableString
@@ -104,6 +105,8 @@ class TextLayoutManagerAbsoluteLayoutWithFractionalPixelTest {
104
105
java.lang.Boolean.TYPE,
105
106
java.lang.Integer.TYPE,
106
107
java.lang.Integer.TYPE,
108
+
java.lang.Integer.TYPE,
109
+
java.lang.Integer.TYPE,
107
110
Layout.Alignment::class.java,
108
111
java.lang.Integer.TYPE,
109
112
TextUtils.TruncateAt::class.java,
@@ -121,6 +124,8 @@ class TextLayoutManagerAbsoluteLayoutWithFractionalPixelTest {
Copy file name to clipboardExpand all lines: packages/react-native/ReactAndroid/src/test/java/com/facebook/react/views/text/TextLayoutManagerMinimumFontScaleTest.kt
+5Lines changed: 5 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,7 @@
7
7
8
8
packagecom.facebook.react.views.text
9
9
10
+
importandroid.graphics.text.LineBreakConfig
10
11
importandroid.text.Layout
11
12
importandroid.text.SpannableString
12
13
importandroid.text.Spanned
@@ -123,6 +124,8 @@ class TextLayoutManagerMinimumFontScaleTest {
0 commit comments