Skip to content

Commit 7b9bfd6

Browse files
yungstersmeta-codesync[bot]
authored andcommitted
Fling: Cleanup enableVirtualViewWindowFocusDetection
Summary: Deletes the `enableVirtualViewWindowFocusDetection` feature flag. It was never rolled out and not found to significantly improve performance. Changelog: [Internal] Differential Revision: D90334082
1 parent 45e4a58 commit 7b9bfd6

25 files changed

Lines changed: 53 additions & 211 deletions

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<3ee5c6b643fa4065a8168ebbb19d4efc>>
7+
* @generated SignedSource<<91ad23aa529522a802b8d03198d7ccb9>>
88
*/
99

1010
/**
@@ -348,12 +348,6 @@ public object ReactNativeFeatureFlags {
348348
@JvmStatic
349349
public fun enableVirtualViewRenderState(): Boolean = accessor.enableVirtualViewRenderState()
350350

351-
/**
352-
* Enables window focus detection for prioritizing VirtualView events.
353-
*/
354-
@JvmStatic
355-
public fun enableVirtualViewWindowFocusDetection(): Boolean = accessor.enableVirtualViewWindowFocusDetection()
356-
357351
/**
358352
* Uses the default event priority instead of the discreet event priority by default when dispatching events from Fabric to React.
359353
*/

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<0c88c86f3085fa7c319b0c0a60102057>>
7+
* @generated SignedSource<<6188f6b73c835b514bd13de3b7a3f55c>>
88
*/
99

1010
/**
@@ -73,7 +73,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
7373
private var enableVirtualViewContainerStateExperimentalCache: Boolean? = null
7474
private var enableVirtualViewDebugFeaturesCache: Boolean? = null
7575
private var enableVirtualViewRenderStateCache: Boolean? = null
76-
private var enableVirtualViewWindowFocusDetectionCache: Boolean? = null
7776
private var fixMappingOfEventPrioritiesBetweenFabricAndReactCache: Boolean? = null
7877
private var fixTextClippingAndroid15useBoundsForWidthCache: Boolean? = null
7978
private var fuseboxAssertSingleHostStateCache: Boolean? = null
@@ -583,15 +582,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
583582
return cached
584583
}
585584

586-
override fun enableVirtualViewWindowFocusDetection(): Boolean {
587-
var cached = enableVirtualViewWindowFocusDetectionCache
588-
if (cached == null) {
589-
cached = ReactNativeFeatureFlagsCxxInterop.enableVirtualViewWindowFocusDetection()
590-
enableVirtualViewWindowFocusDetectionCache = cached
591-
}
592-
return cached
593-
}
594-
595585
override fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean {
596586
var cached = fixMappingOfEventPrioritiesBetweenFabricAndReactCache
597587
if (cached == null) {

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<ca442b740e44e6eea6a8227f00fa1f99>>
7+
* @generated SignedSource<<2528d994ff2ed6ada21f7ff67cdfcd0a>>
88
*/
99

1010
/**
@@ -134,8 +134,6 @@ public object ReactNativeFeatureFlagsCxxInterop {
134134

135135
@DoNotStrip @JvmStatic public external fun enableVirtualViewRenderState(): Boolean
136136

137-
@DoNotStrip @JvmStatic public external fun enableVirtualViewWindowFocusDetection(): Boolean
138-
139137
@DoNotStrip @JvmStatic public external fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean
140138

141139
@DoNotStrip @JvmStatic public external fun fixTextClippingAndroid15useBoundsForWidth(): Boolean

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<15272e1b6cbbcb03b08f453e9cdfccb1>>
7+
* @generated SignedSource<<c9a6da699b29672243ed2535007f3eb2>>
88
*/
99

1010
/**
@@ -129,8 +129,6 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
129129

130130
override fun enableVirtualViewRenderState(): Boolean = true
131131

132-
override fun enableVirtualViewWindowFocusDetection(): Boolean = false
133-
134132
override fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean = false
135133

136134
override fun fixTextClippingAndroid15useBoundsForWidth(): Boolean = false

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<2a0f4c8afaa630631d09e804776197a2>>
7+
* @generated SignedSource<<f691287ee63dfd86f0a1f5a8c16cb0be>>
88
*/
99

1010
/**
@@ -77,7 +77,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
7777
private var enableVirtualViewContainerStateExperimentalCache: Boolean? = null
7878
private var enableVirtualViewDebugFeaturesCache: Boolean? = null
7979
private var enableVirtualViewRenderStateCache: Boolean? = null
80-
private var enableVirtualViewWindowFocusDetectionCache: Boolean? = null
8180
private var fixMappingOfEventPrioritiesBetweenFabricAndReactCache: Boolean? = null
8281
private var fixTextClippingAndroid15useBoundsForWidthCache: Boolean? = null
8382
private var fuseboxAssertSingleHostStateCache: Boolean? = null
@@ -640,16 +639,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
640639
return cached
641640
}
642641

643-
override fun enableVirtualViewWindowFocusDetection(): Boolean {
644-
var cached = enableVirtualViewWindowFocusDetectionCache
645-
if (cached == null) {
646-
cached = currentProvider.enableVirtualViewWindowFocusDetection()
647-
accessedFeatureFlags.add("enableVirtualViewWindowFocusDetection")
648-
enableVirtualViewWindowFocusDetectionCache = cached
649-
}
650-
return cached
651-
}
652-
653642
override fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean {
654643
var cached = fixMappingOfEventPrioritiesBetweenFabricAndReactCache
655644
if (cached == null) {

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<6346af0ed92119faadaec2b5b08b34d1>>
7+
* @generated SignedSource<<f229d1a748eb05b6d796275a68cd636d>>
88
*/
99

1010
/**
@@ -129,8 +129,6 @@ public interface ReactNativeFeatureFlagsProvider {
129129

130130
@DoNotStrip public fun enableVirtualViewRenderState(): Boolean
131131

132-
@DoNotStrip public fun enableVirtualViewWindowFocusDetection(): Boolean
133-
134132
@DoNotStrip public fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean
135133

136134
@DoNotStrip public fun fixTextClippingAndroid15useBoundsForWidth(): Boolean

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -968,9 +968,6 @@ protected void onDetachedFromWindow() {
968968
if (mMaintainVisibleContentPositionHelper != null) {
969969
mMaintainVisibleContentPositionHelper.stop();
970970
}
971-
if (mVirtualViewContainerState != null) {
972-
mVirtualViewContainerState.cleanup();
973-
}
974971
}
975972

976973
@Override

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -475,9 +475,6 @@ protected void onDetachedFromWindow() {
475475
if (mMaintainVisibleContentPositionHelper != null) {
476476
mMaintainVisibleContentPositionHelper.stop();
477477
}
478-
if (mVirtualViewContainerState != null) {
479-
mVirtualViewContainerState.cleanup();
480-
}
481478
}
482479

483480
@Override

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/VirtualViewContainer.kt

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ package com.facebook.react.views.scroll
99

1010
import android.graphics.Rect
1111
import android.view.ViewGroup
12-
import android.view.ViewTreeObserver
1312
import com.facebook.common.logging.FLog
1413
import com.facebook.react.common.build.ReactBuildConfig
1514
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags
@@ -54,15 +53,6 @@ internal abstract class VirtualViewContainerState {
5453
protected val visibleRect: Rect = Rect()
5554
protected val prerenderRect: Rect = Rect()
5655
protected val hysteresisRect: Rect = Rect()
57-
protected val onWindowFocusChangeListener =
58-
if (ReactNativeFeatureFlags.enableVirtualViewWindowFocusDetection()) {
59-
ViewTreeObserver.OnWindowFocusChangeListener {
60-
debugLog("onWindowFocusChanged")
61-
updateModes()
62-
}
63-
} else {
64-
null
65-
}
6656
protected val scrollView: ViewGroup
6757

6858
companion object {
@@ -78,15 +68,6 @@ internal abstract class VirtualViewContainerState {
7868

7969
constructor(scrollView: ViewGroup) {
8070
this.scrollView = scrollView
81-
if (onWindowFocusChangeListener != null) {
82-
scrollView.viewTreeObserver.addOnWindowFocusChangeListener(onWindowFocusChangeListener)
83-
}
84-
}
85-
86-
fun cleanup() {
87-
if (onWindowFocusChangeListener != null) {
88-
scrollView.viewTreeObserver.removeOnWindowFocusChangeListener(onWindowFocusChangeListener)
89-
}
9071
}
9172

9273
open fun onChange(virtualView: VirtualView) {

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/VirtualViewContainerStateClassic.kt

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,7 @@ internal class VirtualViewContainerStateClassic(scrollView: ViewGroup) :
5151
when {
5252
rectsOverlap(rect, visibleRect) -> {
5353
thresholdRect = visibleRect
54-
if (onWindowFocusChangeListener != null) {
55-
if (scrollView.hasWindowFocus()) {
56-
mode = VirtualViewMode.Visible
57-
} else {
58-
mode = VirtualViewMode.Prerender
59-
}
60-
} else {
61-
mode = VirtualViewMode.Visible
62-
}
54+
mode = VirtualViewMode.Visible
6355
}
6456
rectsOverlap(rect, prerenderRect) -> {
6557
mode = VirtualViewMode.Prerender

0 commit comments

Comments
 (0)