Commit 7f18ad0
Ellipsize single-line TextInput placeholders (#57909)
Summary:
On Android, long `TextInput` placeholders are hard-clipped with no trailing ellipsis, while iOS truncates with `…`.
Fixes #29663 (same class of bug as #55272; uses a correct multiline bitmask check and clears ellipsize when multiline is enabled).
**Repro:** https://github.com/kosmydel/android-ellipsize-repro
| Before | After |
|--------|--------|
| <img width="400" alt="image" src="https://github.com/user-attachments/assets/583a8323-03ae-4075-a662-a4c92e8fec9e" /> |<img width="400" alt="image" src="https://github.com/user-attachments/assets/ece0f350-2349-4244-b7c8-56acd7d15e91" /> |
## Changelog
[Android] [Fixed] - Ellipsize long single-line TextInput placeholders to match iOS
Pull Request resolved: #57909
Test Plan:
- Unit: `ReactTextInputPropertyTest` — placeholder sets `TruncateAt.END`; toggling `multiline` clears/restores ellipsize
- Manual: https://github.com/kosmydel/android-ellipsize-repro
- Single-line constrained `TextInput` with a long placeholder → trailing `…`
- Short placeholder unchanged
- `multiline={true}` with a long placeholder → still wraps
- Toggle `multiline` false → true → false → ellipsize restored
Reviewed By: christophpurrer
Differential Revision: D115724716
Pulled By: Abbondanzo
fbshipit-source-id: a267626a4b8d78d5e853729c46400b88a107d53a1 parent 7cdac2a commit 7f18ad0
2 files changed
Lines changed: 29 additions & 0 deletions
File tree
- packages/react-native/ReactAndroid/src
- main/java/com/facebook/react/views/textinput
- test/java/com/facebook/react/views/textinput
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
614 | 614 | | |
615 | 615 | | |
616 | 616 | | |
| 617 | + | |
| 618 | + | |
617 | 619 | | |
618 | 620 | | |
619 | 621 | | |
| |||
629 | 631 | | |
630 | 632 | | |
631 | 633 | | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
632 | 644 | | |
633 | 645 | | |
634 | 646 | | |
| |||
Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
198 | 199 | | |
199 | 200 | | |
200 | 201 | | |
| 202 | + | |
201 | 203 | | |
202 | 204 | | |
203 | 205 | | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
204 | 221 | | |
205 | 222 | | |
206 | 223 | | |
| |||
0 commit comments