Repository navigation
Commit 12e066b
Limit Android 15 bounds-based text width to RTL text (#59504)
Summary:
Pull Request resolved: #59504
On Android 15+, every exactly sized `StaticLayout` enables `setUseBoundsForWidth` and `setShiftDrawingOffsetForStartOverhang` to keep RTL line-start ink from clipping. The exact width usually comes from an earlier `AT_MOST` measurement, which is advance-based. When a font's glyph bounds extend past their advances (seen with some OEM system fonts), a single-line LTR `Text` with `numberOfLines={1}` no longer fits the width it was measured at, and gets ellipsized well inside its own frame.
Only enable the bounds-based width and start-overhang shift when the text contains RTL characters, which is the case the start-overhang handling was added for. LTR-only text goes back to advance-based layout in both passes, so the layout matches the measurement.
Changelog:
[Android][Fixed] - Fix single-line LTR `Text` being ellipsized inside its measured width on Android 15+
Reviewed By: christophpurrer
Differential Revision: D126965612
fbshipit-source-id: 4288a23828c252f999668b8cc0b3d427cdf8dcec1 parent 7320bf4 commit 12e066b
2 files changed
Lines changed: 29 additions & 1 deletion
File tree
- packages/react-native/ReactAndroid/src
- main/java/com/facebook/react/views/text
- test/java/com/facebook/react/views/text
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
902 | 902 | | |
903 | 903 | | |
904 | 904 | | |
905 | | - | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
906 | 911 | | |
907 | 912 | | |
908 | 913 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
49 | 72 | | |
50 | 73 | | |
51 | 74 | | |
| |||
0 commit comments