Commit 58e909b
committed
fix(ios): center TextInput typed text when lineHeight > fontSize on Fabric
Port the Paper-only fix from facebook#38359 to the Fabric path. When
lineHeight > fontSize on iOS, UIKit anchors glyphs to the bottom of
the attributed-string line box, making typed text render visually too
low.
The RCTApplyBaselineOffset helper already ships in Fabric (used by
<Text> in RCTTextLayoutManager) but was never wired into the
<TextInput> path. Call it inside
RCTTextInputComponentView._setAttributedString:.
To avoid an extra mutableCopy on every programmatic text update, also
widen RCTNSAttributedStringFromAttributedString[Box] to return
NSMutableAttributedString *. The Value-mode path already built a
mutable and returned it typed as immutable; the OpaquePointer-mode
path now mutableCopy's explicitly.
Tracked by facebook#39145.1 parent 38aa705 commit 58e909b
3 files changed
Lines changed: 10 additions & 8 deletions
File tree
- packages/react-native
- ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager
- React/Fabric/Mounting/ComponentViews/TextInput
Lines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
575 | 575 | | |
576 | 576 | | |
577 | 577 | | |
578 | | - | |
579 | | - | |
| 578 | + | |
| 579 | + | |
580 | 580 | | |
581 | 581 | | |
582 | 582 | | |
| |||
766 | 766 | | |
767 | 767 | | |
768 | 768 | | |
769 | | - | |
| 769 | + | |
770 | 770 | | |
| 771 | + | |
| 772 | + | |
771 | 773 | | |
772 | 774 | | |
773 | 775 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
405 | 405 | | |
406 | 406 | | |
407 | 407 | | |
408 | | - | |
| 408 | + | |
409 | 409 | | |
410 | 410 | | |
411 | 411 | | |
| |||
428 | 428 | | |
429 | 429 | | |
430 | 430 | | |
431 | | - | |
| 431 | + | |
432 | 432 | | |
433 | 433 | | |
434 | 434 | | |
435 | 435 | | |
436 | 436 | | |
437 | | - | |
| 437 | + | |
438 | 438 | | |
439 | 439 | | |
440 | 440 | | |
| |||
0 commit comments