Skip to content

Commit 8a3cc64

Browse files
rozelemeta-codesync[bot]
authored andcommitted
Remove unnecessary local variable in for deferred focus (#54326)
Summary: Pull Request resolved: #54326 This variable was not needed, isAttachedToWindow was working as expected. ## Changelog [Internal] Reviewed By: Abbondanzo Differential Revision: D85798355 fbshipit-source-id: 1716b323b4ac0d1d6f3e29370223db66540020d2
1 parent b68329f commit 8a3cc64

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

  • packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.kt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ public open class ReactViewGroup public constructor(context: Context?) :
154154
AccessibilityManager.AccessibilityStateChangeListener? =
155155
null
156156
private var focusOnAttach = false
157-
private var hasAttachedToWindowForFocus = false
158157

159158
init {
160159
initView()
@@ -217,7 +216,6 @@ public open class ReactViewGroup public constructor(context: Context?) :
217216

218217
// In case a focus was attempted but the view never attached, reset to false
219218
focusOnAttach = false
220-
hasAttachedToWindowForFocus = false
221219
}
222220

223221
private var _drawingOrderHelper: ViewGroupDrawingOrderHelper? = null
@@ -423,9 +421,7 @@ public open class ReactViewGroup public constructor(context: Context?) :
423421
}
424422

425423
internal fun requestFocusFromJS() {
426-
// We need a local variable here as opposed to the View.isAttachedToWindow check
427-
// since the value is not updated until after the Fabric commit.
428-
if (hasAttachedToWindowForFocus) {
424+
if (isAttachedToWindow) {
429425
super.requestFocus(FOCUS_DOWN, null)
430426
} else {
431427
focusOnAttach = true
@@ -586,7 +582,6 @@ public open class ReactViewGroup public constructor(context: Context?) :
586582
updateClippingRect()
587583
}
588584

589-
hasAttachedToWindowForFocus = true
590585
if (focusOnAttach) {
591586
requestFocusFromJS()
592587
focusOnAttach = false

0 commit comments

Comments
 (0)