-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Add a workaround for text being measured incorrectly when ending with an empty line #42331
Conversation
Base commit: 6c8dfc8 |
This PR is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
Not stale |
8539062
to
13852c3
Compare
@cortinico has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@cortinico merged this pull request in bd32392. |
This pull request was successfully merged by @j-piasecki in bd32392 When will my fix make it into a release? | How to file a pick request? |
FYI that #46613 replaces this logic with a proper fix (we were not correctly propagating settings to TextPaint used for layout) |
Summary:
It looks like
StaticLayout
used for measuring multiline text on the new architecture returns wrong metrics for the last line if it's empty, however, if it contains anything, then the returned values are correct.Similar approach with measuring
I
was already used inReactEditText
:react-native/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java
Lines 1203 to 1213 in 258d8e5
Changelog:
[ANDROID] [FIXED] - Fixed text being measured incorrectly when ending with an empty line on the new architecture
Test Plan:
I tested the change on this simple code on React Native 0.73.2 (with the new arch enabled)
Before:
Screen.Recording.2024-01-17.at.13.10.09.mov
After:
Screen.Recording.2024-01-17.at.13.07.46.mov