Skip to content

Commit

Permalink
fix: don't use deprecated currentlyFocusedField (#8684)
Browse files Browse the repository at this point in the history
currentlyFocusedField => currentlyFocusedInput

Fixes #8457 for 4.x because `createKeyboardAwareNavigator.js` is not inside the `main` branch.

Fixed in main here: 35d6b9e
  • Loading branch information
watadarkstar committed Sep 2, 2020
1 parent 1fa2edd commit 06a69f1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/native/src/createKeyboardAwareNavigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down

1 comment on commit 06a69f1

@gansu18
Copy link

@gansu18 gansu18 commented on 06a69f1 Sep 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks 👍

Please sign in to comment.