Skip to content

Fix TextInput placeholder stuck on multiple lines#57191

Closed
Abbondanzo wants to merge 1 commit into
react:mainfrom
Abbondanzo:export-D108370869
Closed

Fix TextInput placeholder stuck on multiple lines#57191
Abbondanzo wants to merge 1 commit into
react:mainfrom
Abbondanzo:export-D108370869

Conversation

@Abbondanzo

Copy link
Copy Markdown
Contributor

Summary:
On Android, when a TextInput's multiline prop changes from false to true and back to false, the placeholder stayed rendered across multiple lines instead of returning to a single line.

ReactEditText.setInputType only forced the view out of single-line mode when multiline was enabled; it never restored single-line mode when multiline was disabled. TextView.setInputType re-applies its single-line layout (max lines, horizontal scrolling) only when its internal single-line flag actually changes, and because we toggle that flag off whenever multiline is on, it can be stale so the reset is skipped.

On top of that, under the new architecture the view is not re-measured when only the input type changes while the measured size is unchanged. The placeholder is then rebuilt at draw time at the view's physical width and stays wrapped.

This change restores single-line mode when multiline is turned off (skipping secure-text fields so their password transformation method is preserved) and forces a re-measure on the multiline-to-single-line transition, so the placeholder is laid out on a single line again.

Changelog:
[Android][Fixed] - Fix TextInput placeholder staying on multiple lines after multiline is toggled from true back to false

Reviewed By: javache

Differential Revision: D108370869

Summary:
On Android, when a `TextInput`'s `multiline` prop changes from `false` to `true` and back to `false`, the placeholder stayed rendered across multiple lines instead of returning to a single line.

`ReactEditText.setInputType` only forced the view out of single-line mode when `multiline` was enabled; it never restored single-line mode when `multiline` was disabled. `TextView.setInputType` re-applies its single-line layout (max lines, horizontal scrolling) only when its internal single-line flag actually changes, and because we toggle that flag off whenever multiline is on, it can be stale so the reset is skipped.

On top of that, under the new architecture the view is not re-measured when only the input type changes while the measured size is unchanged. The placeholder is then rebuilt at draw time at the view's physical width and stays wrapped.

This change restores single-line mode when `multiline` is turned off (skipping secure-text fields so their password transformation method is preserved) and forces a re-measure on the multiline-to-single-line transition, so the placeholder is laid out on a single line again.

Changelog:
[Android][Fixed] - Fix `TextInput` placeholder staying on multiple lines after `multiline` is toggled from `true` back to `false`

Reviewed By: javache

Differential Revision: D108370869
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 12, 2026
@meta-codesync

meta-codesync Bot commented Jun 12, 2026

Copy link
Copy Markdown

@Abbondanzo has exported this pull request. If you are a Meta employee, you can view the originating Diff in D108370869.

@meta-codesync meta-codesync Bot closed this in df6de4f Jun 12, 2026
@meta-codesync meta-codesync Bot added the Merged This PR has been merged. label Jun 12, 2026
@meta-codesync

meta-codesync Bot commented Jun 12, 2026

Copy link
Copy Markdown

This pull request has been merged in df6de4f.

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

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant