-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
[Android] Wrong TextInput
height when lineHeight
is set
#35951
Comments
I proposed a solution in my comment Expensify/App#14799 (comment) The correct solution for this issue was found by Bee Margarita Expensify/App#14799 (comment) |
@fabriziobertoglio1987 Maybe it would be helpful for the reviewers of this PR if you provided some context on what you're trying to communicate rather than just dropping the link? |
Thanks @roryabraham. I updated my comment. |
I have the same problem but without typing anything, its android specific: the height of the text input on android is too high like 2px on top and 2px at the bottom, the inspector say that there is no padding/margin on it |
This issue 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. |
It seems to have been fixed by 0.74.0-rc.0 Screen.Recording.2024-02-27.at.09.44.05.mov |
Description
When setting the
lineHeight
style onTextInput
, the height of the component is wrong after typing in the first letter. Typing after the first letter causes the height to get back to the correct one, however, deleting the content causes the height to reset as if thelineHeight
is not set.I believe the problem comes from spannable caching, since removing these lines "solves" the problem. It's possible that the order the methods are called in is to blame. It looks like
AndroidTextInputShadowNode::measureContent
is called beforeAndroidTextInputShadowNode::layout
, but the second method may update the state of the component, which effectively makes those methods work with different versions of attributed strings - thecachedAttributedStringId
property is set whenmeasureContent
is called, but the cached spannable gets updated afterwards.Screen.Recording.2023-01-24.at.15.45.49.mov
Version
0.71.1
Output of
npx react-native info
Steps to reproduce
Run the code below and type in one letter into the text input to see it move up, and type another to see the text input sized correctly.
Snack, code example, screenshot, or link to a repository
The text was updated successfully, but these errors were encountered: