Skip to content

[fix] TextInput multiline defaults to 1 row - #2861

Merged
zoontek merged 2 commits into
necolas:masterfrom
u9g:textinput-rows-default
Oct 27, 2026
Merged

zoontek merged 2 commits into
necolas:masterfrom
u9g:textinput-rows-default

Conversation

@u9g

@u9g u9g commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

The docs for TextInput say rows defaults to 1, and it did: numberOfLines defaulted to 1 until 6795738 moved the default onto rows, and 7638301 then removed it from rows to let numberOfLines act as a fallback, leaving no final default. Since 0.19 a multiline input without rows/numberOfLines renders a <textarea> with no rows attribute, so browsers apply their own default of 2 rows, and a multiline input starts two lines tall on web while it starts one line tall on iOS and Android.

The fix restores the final fallback to 1 in the rows ?? numberOfLines ?? 1 chain. A test renders <TextInput multiline /> and checks rows="1".

npm run unit, lint and format pass for the package; flow could not be run locally (flow-bin has no arm64 build), so relying on CI for it.

@codesandbox-ci

Copy link
Copy Markdown

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 60637fe:

Sandbox Source
react-native-web-examples Configuration

u9g and others added 2 commits October 27, 2026 12:29
The docs state that 'rows' defaults to 1, and it did until the prop
fallback refactor in 7638301 dropped the final default. Since then a
multiline TextInput without 'rows' or 'numberOfLines' renders a textarea
with no 'rows' attribute, so browsers apply their default of 2 rows.

# Conflicts:
#	packages/react-native-web/src/exports/TextInput/index.js
@zoontek
zoontek force-pushed the textinput-rows-default branch from 60637fe to 9ae761a Compare October 27, 2026 11:31
@zoontek
zoontek merged commit f3d89de into necolas:master Oct 27, 2026
5 checks passed
@zoontek

zoontek commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants