Skip to content

Commit 111d1e7

Browse files
Take Text ellipsizeMode from the measured paragraph attributes on Android
Summary: On Android, `ReactTextView` measured text with the paragraph attributes from its state, but drew the ellipsis from a separate `ellipsizeMode` view prop that starts as `tail`. The paragraph attributes default `ellipsizeMode` to `clip`. When a view is created with props that omit values equal to their defaults, an explicit `ellipsizeMode="clip"` never reached the view prop, so text with `numberOfLines` was truncated with an ellipsis instead of being clipped. `ReactTextView` now takes the ellipsis from the same paragraph attributes it is measured with, like `minimumFontSize` and `textBreakStrategy`, so a single source of truth decides it, as on iOS. Changelog: [Android][Fixed] - Fix `ellipsizeMode="clip"` being ignored on newly created `Text` Differential Revision: D123029564
1 parent 52efed6 commit 111d1e7

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewManager.kt‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,13 @@ public constructor(
178178
else Float.NaN
179179
view.setMinimumFontScale(minimumFontScale)
180180

181+
view.setEllipsizeLocation(
182+
TextAttributeProps.getEllipsizeMode(
183+
paragraphAttributes.getString(TextLayoutManager.PA_KEY_ELLIPSIZE_MODE),
184+
),
185+
)
186+
view.updateView()
187+
181188
// Clear any stale PreparedLayout from a previous update
182189
view.setPreparedLayout(null)
183190

0 commit comments

Comments
 (0)