Repository navigation
Commit 2827a45
Position iOS inline views from their line's actual baseline
Summary:
Fixes an issue where inline views in text on iOS are not properly positioned from their actual baseline, resulting in situations where the view/image appears lower than expected or with less padding from the previous line.
### Root Cause
After TextKit lays out the text, RCTTextLayoutManager positions an inline view's frame on the baseline using `glyphRect.origin.y + glyphRect.size.height` to calculate the line bottom, then adding `font.descender` to move up from the line's bottom to its baseline. However, when a line only contains an attachment, no space is reserved below the baseline for descenders (the tails of g, y, p). This means inline views are placed directly at the line bottom instead of the baseline.
### This PR
Modify RCTTextLayoutManager so that instead of manually computing the baseline, we ask TextKit for the baseline used on that line.
Changelog: [iOS][Fixed] - Fix inline views on iOS being misaligned from the baseline
Differential Revision: D1279321691 parent 1e9dc77 commit 2827a45
1 file changed
Lines changed: 8 additions & 10 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 | |
|---|---|---|---|
| |||
653 | 653 | | |
654 | 654 | | |
655 | 655 | | |
656 | | - | |
657 | | - | |
658 | | - | |
659 | | - | |
660 | | - | |
661 | | - | |
662 | | - | |
663 | | - | |
664 | | - | |
665 | | - | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
666 | 664 | | |
667 | 665 | | |
668 | 666 | | |
| |||
0 commit comments