Skip to content

Conversation

@soutua
Copy link

@soutua soutua commented Oct 24, 2025

Summary:

Fixes issue #53450

There are some discussion and explanation about the issue here: #53450 (comment)

In short, there seems to be a rounding error occurring with the new architecture's implementation when the text paragraph line heights are calculated on iOS, that happens randomly and depends on what text content the view has, and on the device screen.

The fix is basically the same that had been implemented in the React Native's old architecture 8 years ago, but hasn't been brought into the new architecture implementation. The fix adds a fraction to the text line dimensions to mitigate the rounding error.

Changelog:

[IOS] [FIXED] - Fix rounding error occurring randomly in iOS text line height calculation

Test Plan:

Note that the reproduction of the issue is also dependant on the used device/simulator, this was tested using the iPhone 17 simulator.

  • Go to Text Layout Example in the RNTester app
  • Scroll down the text until you see this text paragraph:

Without the fix:
without-the-fix

With the fix:

with-the-fix

@meta-cla
Copy link

meta-cla bot commented Oct 24, 2025

Hi @soutua!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@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 24, 2025
@meta-cla
Copy link

meta-cla bot commented Oct 24, 2025

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@facebook-github-bot facebook-github-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 24, 2025
Copy link
Contributor

@cipolleschi cipolleschi left a comment

Choose a reason for hiding this comment

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

@soutua thanks for the fix!

@meta-codesync
Copy link

meta-codesync bot commented Oct 24, 2025

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

@emaestre
Copy link

Hey guys! Thank you so much for the fix 🚀 is there any timeline to get this released? I think that a lot of apps are having this trouble.

Thanks!

@cipolleschi
Copy link
Contributor

Hey @soutua
Can I ask you to:

  1. rebase
  2. add an example screen in RNTester
  3. show the before and after in the TestCase. So basically we want to see the problem before the fix and the problem fixed after the fix.

@emaestre the steps are:

  1. The PR needs to be merged
  2. if it is merged before friday of the next week, it will be released in 0.83
  3. if you guys needs this fix in a previous version of react native, we need a cherry pick request
  4. After the commit is picked, it will be included in the next patch release of the version.

@soutua soutua force-pushed the fix-ios-line-height-calculation branch from cab8bb5 to 7a885cb Compare October 28, 2025 11:05
@soutua
Copy link
Author

soutua commented Oct 28, 2025

Hey @soutua Can I ask you to:

  1. rebase
  2. add an example screen in RNTester
  3. show the before and after in the TestCase. So basically we want to see the problem before the fix and the problem fixed after the fix.

I've now rebased and added a new text layout example screen in the RNTester app, I've also updated the test plan in the issue description to showcase the before/after difference.

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.

4 participants