Commit 79c4798
Fix issue where text inputs cannot blur on <= Android 8.1 (#51302)
Summary:
Pull Request resolved: #51302
We got #51072 (comment) which demonstrates that if we have 2 text inputs on a screen we cannot blur them. If you try to blur any, focus jumps to the first one.
This seems to be a bug with Android's `clearFocus` per https://developer.android.com/reference/android/view/View#clearFocus(), this behavior is intended when we are not in touch mode, yet it happens regardless of what mode we are in on this version.
I modified this a bit to swallow `requestFocus` calls if we are in touch mode. This should be fine as no JS focus calls will go through this path. On hardware keyboard focus and focus from `clearFocus`
Changelog: [Android] [Fixed] - Fix bug where focus would jump to top text input upon clearing a separate text input.
Reviewed By: mlord93
Differential Revision: D74678847
fbshipit-source-id: 12dcaf0c9c350d3ed697ff81e8dfb205b79421191 parent 5dd4891 commit 79c4798
2 files changed
Lines changed: 17 additions & 2 deletions
File tree
- packages/react-native/ReactAndroid
- api
- src/main/java/com/facebook/react/views/textinput
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6553 | 6553 | | |
6554 | 6554 | | |
6555 | 6555 | | |
| 6556 | + | |
6556 | 6557 | | |
6557 | 6558 | | |
6558 | 6559 | | |
| |||
Lines changed: 16 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
364 | 364 | | |
365 | 365 | | |
366 | 366 | | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
367 | 382 | | |
368 | | - | |
369 | | - | |
| 383 | + | |
370 | 384 | | |
371 | 385 | | |
372 | 386 | | |
| |||
0 commit comments