diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java index 56a10692cf15a3..bb15ffc3e2aeee 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java @@ -190,7 +190,7 @@ public boolean performAccessibilityAction(View host, int action, Bundle args) { // selection on accessibility click to undo that. setSelection(length); } - return requestFocusInternal(); + return requestFocus(View.FOCUS_DOWN, null); } return super.performAccessibilityAction(host, action, args); } @@ -347,18 +347,8 @@ public void clearFocus() { @Override public boolean requestFocus(int direction, Rect previouslyFocusedRect) { - // This is a no-op so that when the OS calls requestFocus(), nothing will happen. ReactEditText - // is a controlled component, which means its focus is controlled by JS, with two exceptions: - // autofocus when it's attached to the window, and responding to accessibility events. In both - // of these cases, we call requestFocusInternal() directly. - return isFocused(); - } - - private boolean requestFocusInternal() { setFocusableInTouchMode(true); - // We must explicitly call this method on the super class; if we call requestFocus() without - // any arguments, it will call into the overridden requestFocus(int, Rect) above, which no-ops. - boolean focused = super.requestFocus(View.FOCUS_DOWN, null); + boolean focused = super.requestFocus(direction, previouslyFocusedRect); if (getShowSoftInputOnFocus()) { showSoftKeyboard(); } @@ -634,7 +624,7 @@ public void maybeUpdateTypeface() { // VisibleForTesting from {@link TextInputEventsTestCase}. public void requestFocusFromJS() { - requestFocusInternal(); + requestFocus(View.FOCUS_DOWN, null); } /* package */ void clearFocusFromJS() { @@ -1087,7 +1077,7 @@ public void onAttachedToWindow() { } if (mAutoFocus && !mDidAttachToWindow) { - requestFocusInternal(); + requestFocus(View.FOCUS_DOWN, null); } mDidAttachToWindow = true;