Skip to content

Commit ba914dc

Browse files
joevilchesfacebook-github-bot
authored andcommitted
Back out "Fix issue where text inputs cannot blur on <= Android 8.1"
Summary: Original commit changeset: 12dcaf0c9c35 Original Phabricator Diff: D74678847 I plan on reverting this so that we can in turn revert the diff that this diff fixed so we can pick it into RN 0.80 so that users have some fix on all versions. Right now 0.80 will be broken for older android devices Changelog: [Internal] Differential Revision: D74754164
1 parent 6766cf6 commit ba914dc

2 files changed

Lines changed: 2 additions & 17 deletions

File tree

packages/react-native/ReactAndroid/api/ReactAndroid.api

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6553,7 +6553,6 @@ public class com/facebook/react/views/textinput/ReactEditText : androidx/appcomp
65536553
public fun onTextContextMenuItem (I)Z
65546554
public fun onTouchEvent (Landroid/view/MotionEvent;)Z
65556555
public fun removeTextChangedListener (Landroid/text/TextWatcher;)V
6556-
public fun requestFocus (ILandroid/graphics/Rect;)Z
65576556
public final fun requestFocusFromJS ()V
65586557
public final fun setAllowFontScaling (Z)V
65596558
public final fun setAutoFocus (Z)V

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.kt

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -364,23 +364,9 @@ public open class ReactEditText public constructor(context: Context) : AppCompat
364364
hideSoftKeyboard()
365365
}
366366

367-
override fun requestFocus(direction: Int, previouslyFocusedRect: Rect?): Boolean {
368-
// On some older versions of Android there is a bug where `clearFocus` will try to focus the
369-
// first focusable View in the hierarchy after clearing focus. This is intended behavior, but
370-
// only if you are not in touch mode per
371-
// https://developer.android.com/reference/android/view/View#clearFocus(), yet this happens in
372-
// both. Therefore, we are swallowing Android-based focus calls if we are in touch mode.
373-
// If we are not in touch mode (using a hardware keyboard) then we will allow this to happen.
374-
// Note this only happens for Android-origin focus calls, as opposed to JS-origin (like tapping)
375-
// since those go through `requestFocusProgrammatically`
376-
if (isInTouchMode) {
377-
return isFocused
378-
}
379-
return super.requestFocus(direction, previouslyFocusedRect)
380-
}
381-
382367
// For cases like autoFocus, or ref.focus() where we request focus programmatically and not
383-
// through interacting with the EditText directly (like clicking on it). We cannot use stock
368+
// through
369+
// interacting with the EditText directly (like clicking on it). We cannot use stock
384370
// requestFocus() because it will not pop up the soft keyboard, only clicking the input will do
385371
// that. This method will eventually replace requestFocusInternal()
386372
private fun requestFocusProgrammatically(): Boolean {

0 commit comments

Comments
 (0)