Repository navigation
Conversation
Merged
4 tasks
Visual regression1 visual difference(s) at android: no capture ios
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mozzius
force-pushed
the
inline-view-baseline
branch
from
October 27, 2026 21:56
cfd4309 to
aae21af
Compare
Contributor
Author
|
I am fairly certain the visual regression test is a flake, but I'll try and confirm locally |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary:
Fixes #59549.
On iOS, a
Viewnested in aTextis placed below the text baseline, while Android puts its bottom exactly on the baseline._measureTextStorage:puts the attachment's bottom at the bottom of its glyph rect plusfont.descender, wherefontis the font on the attachment's own run. That's only the baseline in a narrow case:NSTextStoragefills in its default, 12pt Helvetica (descender −2.76), whatever the surrounding text is.lineHeighttaller than the font raises the glyphs by(lineHeight - font.lineHeight) / 2(RCTApplyBaselineOffset). The line bottom plus a descender doesn't include that.So the view sits
|line descender| + baseline offset - 2.76below the baseline: 0.86pt for 15pt system text, 3.91pt withlineHeight: 24, and 14.15pt for 24pt text withlineHeight: 36at the first accessibility text size. The current formula came in with #53341 in 0.82, to fix #53092; on 0.81 the same screen puts the view on the baseline in all but the #53092 case.This places the attachment on the baseline TextKit actually laid its line out with: the line fragment's origin plus the attachment glyph's location within it. That includes the baseline offset and the line's largest font, and it's the baseline
onTextLayoutreports for each line. It also fixes the #53092 case, where the view is taller than the line's ascent.Compared with the open PRs for this:
fixTextInlineViewLineHeight, but keeps the run'sfont.descender. Going by its diff, the|descender| - 2.76error would remain (0.86pt for 15pt text).Changelog:
[IOS] [FIXED] - Views nested in
Textsit on the text baseline instead of below itTest Plan:
Reproducer: https://github.com/mozzius/inline-view-baseline-repro (RN 0.88.0, with this change as a patch behind a runtime stock/fixed switch). Each row is a
Textwith a nested blueView; the red hairline is the line's baseline fromonTextLayout.View bottom minus baseline, in points (positive is below), on an iPhone 17 Pro simulator (iOS 26.5):
lineHeightlineHeightThe letters sit exactly on the hairline in every screenshot. The repro's README has the logs, the formula-vs-measurement tables, and the 0.81.6 and Android comparisons.
We also ship this as a patch in the Bluesky app (RN 0.88), where it moved verification badges inside display names from 2.2pt below centre (5–7pt at the accessibility text sizes) to within 0.2pt (bluesky-social/social-app#12229).
🤖 Generated with Claude Code