Repository navigation
Commit b69e281
Draw text with unbounded height on iOS (#59793)
Summary:
Fixes an issue where text wrapping behavior on iOS differs from Android and web when the text does not fit in its parent container.
### Root Cause
On iOS, React Native lays out text during measurement and drawing. `RCTTextLayoutManager::measureNSAttributedString()` uses an unbounded height during measurement to position where text and inline views should be. However, during drawing, the actual frame size is used. When TextKit reaches a point where the next line of text doesn't fit inside the container's height, it stops wrapping and puts everything on the current line. This leads to different wrapping behavior compared to Android and web, especially when inline views are included in text.
### This PR
Modify RCTTextLayoutManager so that drawing also uses unbounded height, matching the existing measurement code. This means TextKit never tries to alter wrapping behavior.
Changelog: [iOS][Fixed] - Text taller than a fixed-height `<Text>` now wraps normally and is clipped at the bottom edge, matching Android and web
Reviewed By: vzaidman
Differential Revision: D1279319491 parent 93019c4 commit b69e281
1 file changed
Lines changed: 15 additions & 3 deletions
File tree
- packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
42 | 54 | | |
43 | 55 | | |
44 | 56 | | |
| |||
136 | 148 | | |
137 | 149 | | |
138 | 150 | | |
139 | | - | |
| 151 | + | |
140 | 152 | | |
141 | 153 | | |
142 | 154 | | |
| |||
475 | 487 | | |
476 | 488 | | |
477 | 489 | | |
478 | | - | |
| 490 | + | |
479 | 491 | | |
480 | 492 | | |
481 | 493 | | |
| |||
506 | 518 | | |
507 | 519 | | |
508 | 520 | | |
509 | | - | |
| 521 | + | |
510 | 522 | | |
511 | 523 | | |
512 | 524 | | |
| |||
0 commit comments