mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-01-12 22:51:18 +08:00
fix: android textinput gets blurred after navigating back
When navigating from ScreenA to ScreenB and then back to ScreenA, react-navigation unconditionally calls `Keyboard.dismiss()`. If the user is fast enough and taps on a `TextInput` after coming back from ScreenB, the keyboard opens, just to be dismissed again. This would also happen if some logic automatically focuses the `TextInput` in ScreenA. This behaviour can be seen observed in https://snack.expo.io/lTDZhVNhV.
This commit is contained in:
@@ -58,10 +58,12 @@ export default class KeyboardManager extends React.Component<Props> {
|
||||
|
||||
const input = this.previouslyFocusedTextInput;
|
||||
|
||||
if (Platform.OS === 'android') {
|
||||
Keyboard.dismiss();
|
||||
} else if (input) {
|
||||
TextInput.State.blurTextInput(input);
|
||||
if (input) {
|
||||
if (Platform.OS === 'android') {
|
||||
Keyboard.dismiss();
|
||||
} else {
|
||||
TextInput.State.blurTextInput(input);
|
||||
}
|
||||
}
|
||||
|
||||
// Cleanup the ID on successful page change
|
||||
|
||||
Reference in New Issue
Block a user