Skip to content

fix(ios): align inline views with inherited fonts and line heights - #58967

Open
mym0404 wants to merge 6 commits into
react:mainfrom
mj-studio-playground:fix/ios-inline-view-inherited-font
Open

mym0404 wants to merge 6 commits into
react:mainfrom
mj-studio-playground:fix/ios-inline-view-inherited-font

Conversation

@mym0404

@mym0404 mym0404 commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary:

iOS Fabric inline <View> attachments use a fallback font and miss the baseline offset from an explicit lineHeight. Preserve the enclosing <Text> font on each attachment and subtract NSBaselineOffsetAttributeName when positioning the View.

The reproduction is included in RNTester under Text > Inline view baseline alignment, with ten samples, numeric alignment differences, and Dynamic Type. Direct link: rntester://example/TextExample/inline-view-baseline.

RNTester source-build results, commands, and measurements

Before After
RNTester before, default text size RNTester after, default text size
RNTester before, enlarged text RNTester after, enlarged text

Changelog:

[IOS] [FIXED] - Align inline Views with inherited fonts and explicit lineHeight.

Test Plan:

  • RNTester native source builds before and after the fix on iPhone 18 Pro / iOS 27.0, Xcode 27.2: succeeded.
  • All nine measurable cases are within one physical pixel (0.333 pt) at system font scales 1.0 and 2.143; only the last sample enables scaling. lineHeight: 48 error is 10.293 pt before and -0.041 pt after. Maximum displayed error after the fix: 0.151 pt.
  • Example search, direct links, and scrolling: passed. Both inline-view examples remain available after merging main. The full Flow check (yarn flow-check --max-workers 6) reported 0 errors. Prettier, ESLint, clang-format, and the PR diff's whitespace checks passed.
  • Earlier verification: 35 native font/attributed-string tests passed; Android API 37's nine cases stayed within 0.0001 dp at scales 1.0 and 1.75 (results).

Nested Text is checked visually because its public View measurement is unavailable.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 9, 2026
@mym0404
mym0404 marked this pull request as ready for review October 9, 2026 16:29
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Oct 9, 2026
@mym0404 mym0404 changed the title fix(ios): inherit text fonts for inline attachments fix(ios): align inline views with inherited fonts and line heights Oct 9, 2026
@mym0404

mym0404 commented Oct 30, 2026

Copy link
Copy Markdown
Contributor Author

Hi @cipolleschi, could you please review this iOS inline View alignment fix when you have a chance? Thank you!

@mym0404

mym0404 commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

Hi @cortinico, could you please review this iOS inline View alignment fix when you have a chance? Thank you!

@cortinico cortinico left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reproduction | Measurements and logs

Can we add this reproduction to RNTester please?

@cortinico

Copy link
Copy Markdown
Contributor

@mym0404 also pls fix merge conflicts

@mym0404

mym0404 commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

@cortinico conflicts have been resolved.

@meta-codesync

meta-codesync Bot commented Nov 13, 2026

Copy link
Copy Markdown

@cortinico has imported this pull request. If you are a Meta employee, you can view this in D131806404.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants