Commit 0873116
Fix secure Android TextInput same-text updates (#57013)
Summary:
Fixes #53696.
Android secure `TextInput` has a guard that skips replacing text when JS echoes the same content, preserving Android's transient password reveal timer. During the Kotlin conversion, this guard changed from `TextUtils.equals(...)` to equality between the current `Editable` and incoming `Spanned` text. Those can contain the same characters without comparing equal, so state updates re-apply the text immediately and hide the latest revealed password character.
This restores content-based equality for secure text updates and adds a regression test that same-text secure updates do not replace the existing `Editable`.
## Changelog:
[ANDROID] [FIXED] - Preserve secure TextInput password character reveal timing when JS state echoes the same text.
Pull Request resolved: #57013
Test Plan:
- `./gradlew :packages:react-native:ReactAndroid:testDebugUnitTest --tests com.facebook.react.views.textinput.ReactTextInputPropertyTest -Preact.internal.useHermesStable=true`
- `./gradlew :packages:react-native:ReactAndroid:ktfmtCheck -Preact.internal.useHermesStable=true`
Reviewed By: cortinico
Differential Revision: D107094261
Pulled By: javache
fbshipit-source-id: 68d087a7b4f0d6021cc31456ef50245c11552b2b1 parent 63dec77 commit 0873116
2 files changed
Lines changed: 31 additions & 1 deletion
File tree
- packages/react-native/ReactAndroid/src
- main/java/com/facebook/react/views/textinput
- test/java/com/facebook/react/views/textinput
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
648 | 649 | | |
649 | 650 | | |
650 | 651 | | |
651 | | - | |
| 652 | + | |
652 | 653 | | |
653 | 654 | | |
654 | 655 | | |
| |||
Lines changed: 29 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
| |||
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
| 37 | + | |
35 | 38 | | |
36 | 39 | | |
37 | 40 | | |
| |||
481 | 484 | | |
482 | 485 | | |
483 | 486 | | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
484 | 511 | | |
485 | 512 | | |
486 | 513 | | |
| 514 | + | |
| 515 | + | |
487 | 516 | | |
0 commit comments