-
Couldn't load subscription status.
- Fork 24.9k
fix(ios): Fix rounding error occurring randomly in iOS text line height calculation #54260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Hi @soutua! Thank you for your pull request and welcome to our community. Action RequiredIn 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. ProcessIn 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 If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
There was a problem hiding this 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!
|
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this in D85438723. |
|
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! |
|
Hey @soutua
@emaestre the steps are:
|
cab8bb5 to
7a885cb
Compare
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. |
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.
Without the fix:

With the fix: