Commit 3560753
Fix TextInput Cursor jumping to the right when the placeholder null (facebook#28995)
Summary:
This issue fixes facebook#28794 fixes facebook#27658
Flow type ?Stringish allows to set the placeholder value to null. The null value causes the cursor to jump to the right in a TextInput. The fix replaces the placeholder null value with an empty string which avoid calling setHint(null) as causes the placeholder to jump to the right.
## Changelog
<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->
[Android] [Fixed] - avoid calling setHint with a null parameter causing cursor to jump to the right
Pull Request resolved: facebook#28995
Test Plan:
**<details><summary>CLICK TO OPEN TESTS RESULTS (28 May 2020 20a9473)</summary>**
<p>
More videos and information included in issue facebook#28794
The below test cases are from the [following repository](https://github.com/fabriziobertoglio1987/AwesomeProject)
| **BEFORE** |
|:-------------------------:|
| <img src="https://user-images.githubusercontent.com/24992535/83123470-3e2f8000-a0d5-11ea-8718-11e6a0575a0c.gif" />|
| **AFTER** |
|:-------------------------:|
| <img src="https://user-images.githubusercontent.com/24992535/83123554-599a8b00-a0d5-11ea-9701-6557f0d76044.gif" />|
Extensive testing on `RNTester` did not identify any regression.
| **AFTER** |
|:-------------------------:|
| <img src="https://user-images.githubusercontent.com/24992535/83123586-628b5c80-a0d5-11ea-92eb-449d499dcc7d.gif" />|
</p>
</details>
**<details><summary>CLICK TO OPEN TESTS RESULTS (15 February 2021 https://github.com/facebook/react-native/pull/28995/commits/20a9473aaa330ad9b6e7a0b42ebd9c4ed41ce60b)</summary>**
<p>
| **BEFORE** |
|:-------------------------:|
| <video src="https://user-images.githubusercontent.com/24992535/107960803-5d44a980-6fa5-11eb-90e2-f0d665e35291.mp4" />|
| **AFTER** |
|:-------------------------:|
| <video src="https://user-images.githubusercontent.com/24992535/107960602-1f478580-6fa5-11eb-8f39-b985fafa6a6c.mp4" />|
</p>
</details>
Reviewed By: charlesbdudley
Differential Revision: D30095877
Pulled By: lunaleaps
fbshipit-source-id: 38a3e788443a22d48a4335063cd4315638bd8e971 parent f1b4748 commit 3560753
File tree
3 files changed
+4
-3
lines changed- Libraries/Components/TextInput
- ReactAndroid/src/main/java/com/facebook/react/views/textinput
3 files changed
+4
-3
lines changedLines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | 26 | | |
28 | 27 | | |
29 | 28 | | |
| |||
415 | 414 | | |
416 | 415 | | |
417 | 416 | | |
418 | | - | |
| 417 | + | |
419 | 418 | | |
420 | 419 | | |
421 | 420 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1163 | 1163 | | |
1164 | 1164 | | |
1165 | 1165 | | |
| 1166 | + | |
1166 | 1167 | | |
1167 | 1168 | | |
1168 | 1169 | | |
| |||
1205 | 1206 | | |
1206 | 1207 | | |
1207 | 1208 | | |
| 1209 | + | |
1208 | 1210 | | |
1209 | 1211 | | |
1210 | 1212 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
459 | 459 | | |
460 | 460 | | |
461 | 461 | | |
462 | | - | |
| 462 | + | |
463 | 463 | | |
464 | 464 | | |
465 | 465 | | |
| |||
0 commit comments