Skip to content

Include top padding and border in Fabric text baselines - #60377

Open
ecryptoguru wants to merge 1 commit into
react:mainfrom
ecryptoguru:fix/paragraph-baseline-content-inset
Open

ecryptoguru wants to merge 1 commit into
react:mainfrom
ecryptoguru:fix/paragraph-baseline-content-inset

Conversation

@ecryptoguru

Copy link
Copy Markdown

Summary:

Two Text siblings in a row with alignItems: 'baseline' draw their letters at different heights if one has top padding or a top border. Yoga asks for the distance from the top of the box to the first baseline; Fabric returned the first line’s ascender, measured from the text content. This adds the resolved top padding and border to that distance, as the text input renderer already does.

Fixes #60338.

Changelog:

[GENERAL] [FIXED] - Align text baselines correctly when a text element has top padding or a top border.

Test Plan:

  • Built RNTester in release mode from the original source and again with the renderer change. On Android 17 (API 37, ARM64), the same screen reported 0 dp before and 24 dp after for 20 dp of top padding plus a 4 dp border. The Maestro assertion failed before the fix and passed afterward. Screenshots, test command and output.
  • In a second Android run, a top-only 30 dp inset produced a 29.71 dp offset after pixel rounding. No padding, bottom padding alone, and wrapped text kept their earlier positions.
  • ESLint and Prettier passed on the RNTester example. iOS simulator verification is running separately on the fork.

Prepared with Codex assistance.

@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 Nov 28, 2026
@github-actions github-actions Bot added the Meta Review Required This PR is considered risky and requires Meta to import it to do more testing before merging. label Nov 28, 2026
@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 Nov 28, 2026

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. Meta Review Required This PR is considered risky and requires Meta to import it to do more testing before merging. 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.

A Text's baseline leaves out its paddingTop, so alignItems: 'baseline' places a padded Text as if it had no padding

1 participant