mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-03-06 17:34:59 +08:00
fix: don't use deprecated currentlyFocusedField (#8684)
currentlyFocusedField => currentlyFocusedInput
Fixes #8457 for 4.x because `createKeyboardAwareNavigator.js` is not inside the `main` branch.
Fixed in main here: 35d6b9e3a4
This commit is contained in:
@@ -8,7 +8,9 @@ export default (Navigator, navigatorConfig) =>
|
||||
_previouslyFocusedTextInput = null;
|
||||
|
||||
_handleGestureBegin = () => {
|
||||
this._previouslyFocusedTextInput = TextInput.State.currentlyFocusedField();
|
||||
this._previouslyFocusedTextInput = TextInput.State.currentlyFocusedInput
|
||||
? TextInput.State.currentlyFocusedInput()
|
||||
: TextInput.State.currentlyFocusedField();
|
||||
if (this._previouslyFocusedTextInput) {
|
||||
TextInput.State.blurTextInput(this._previouslyFocusedTextInput);
|
||||
}
|
||||
@@ -32,7 +34,9 @@ export default (Navigator, navigatorConfig) =>
|
||||
// in the case where the index did not change, I believe. We
|
||||
// should revisit this after 2.0 release.
|
||||
if (transitionProps.index !== prevTransitionProps.index) {
|
||||
const currentField = TextInput.State.currentlyFocusedField();
|
||||
const currentField = TextInput.State.currentlyFocusedInput
|
||||
? TextInput.State.currentlyFocusedInput()
|
||||
: TextInput.State.currentlyFocusedField();
|
||||
if (currentField) {
|
||||
TextInput.State.blurTextInput(currentField);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user