fix: textinput multiline with numberoflines issue #4784 #4833
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
When using , the component does not respect the specified number of lines. The height remains fixed, causing layout issues and requiring manual intervention from the developer.
Motivation
The internal height calculation logic runs after layout instead of before render. Because of this, the initial height is not correctly set based on numberOfLines. The native height is applied later, leading to a mismatch.
Solution
Related issue
#4784 – TextInput with multiline and numberOfLines does not correctly adjust height
Test plan
Note
Ensure multiline TextInput respects numberOfLines by precomputing minHeight from themed lineHeight and applying it via contentStyle.
lineHeightfrom theme (bodyLarge→regularfallback → default24).autoHeightformultilinewithnumberOfLinesand apply asminHeightviacontentStylearray in bothTextInputFlatandTextInputOutlined.contentStylearrays and resulting minHeight/layout changes.Written by Cursor Bugbot for commit 4e2543e. This will update automatically on new commits. Configure here.