Skip to content

Commit 083fd99

Browse files
javachemeta-codesync[bot]
authored andcommitted
Cleanup enableVirtualViewDebugFeatures and FlingItemOverlay (#56946)
Summary: Pull Request resolved: #56946 The `enableVirtualViewDebugFeatures` feature flag was effectively dead — its only MobileConfig backing param (`rn_fling.fling_debug`) hadn't been updated in 365+ days, and the codemod-tracking diff D105936405 was already queued to remove the three native overrides. Rather than carry the FF + JS overlay surface forward, delete the whole stack: the FF, the overrides, the BUCK dep, the JS overlay components (`FlingItemOverlay`, `FlingDebugItemOverlay`, `FlingDebugOverlay`), the debug-log helpers in the native ScrollView/VirtualView implementations on both iOS and Android, and the now-orphaned references in `VirtualCollectionView`. Net: 4 files deleted, the FF removed from the cross-language codegen, native debug logging dropped from 5 files (1 ObjC++, 4 Kotlin), and consumer code in `VirtualCollectionView` simplified. Changelog: [General][Removed] - Remove unused `enableVirtualViewDebugFeatures` feature flag and the associated `FlingItemOverlay` / `FlingDebugItemOverlay` debug surfaces. Reviewed By: lunaleaps Differential Revision: D105959433 fbshipit-source-id: 40cba737f3191f3e2501677a16b8b738ec9310c5
1 parent cf28e6b commit 083fd99

27 files changed

Lines changed: 88 additions & 258 deletions

packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTVirtualViewContainerState.mm

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,21 @@
1616
using namespace facebook;
1717
using namespace facebook::react;
1818

19-
#if RCT_DEBUG
19+
#define ENABLE_DEBUG_LOGGING 0 && RCT_DEBUG
20+
21+
#if ENABLE_DEBUG_LOGGING
2022
static void debugLog(NSString *msg, ...)
2123
{
22-
auto debugEnabled = ReactNativeFeatureFlags::enableVirtualViewDebugFeatures();
23-
if (!debugEnabled) {
24-
return;
25-
}
26-
2724
va_list args;
2825
va_start(args, msg);
2926
NSString *msgString = [[NSString alloc] initWithFormat:msg arguments:args];
3027
RCTLogInfo(@"%@", msgString);
3128
va_end(args); // Don't forget to call va_end to clean up
3229
}
3330

31+
#define DEBUG_LOG(...) debugLog(__VA_ARGS__)
32+
#else
33+
#define DEBUG_LOG(...) ((void)0)
3434
#endif
3535

3636
/**
@@ -87,18 +87,14 @@ - (instancetype)initWithScrollView:(RCTScrollViewComponentView *)scrollView
8787
_prerenderRatio = ReactNativeFeatureFlags::virtualViewPrerenderRatio();
8888
[_scrollViewComponentView addScrollListener:self];
8989

90-
#if RCT_DEBUG
91-
debugLog(@"initWithScrollView");
92-
#endif
90+
DEBUG_LOG(@"initWithScrollView");
9391
}
9492
return self;
9593
}
9694

9795
- (void)dealloc
9896
{
99-
#if RCT_DEBUG
100-
debugLog(@"dealloc");
101-
#endif
97+
DEBUG_LOG(@"dealloc");
10298
if (_scrollViewComponentView != nil) {
10399
[_scrollViewComponentView removeScrollListener:self];
104100
_scrollViewComponentView = nil;
@@ -112,14 +108,9 @@ - (void)onChange:(id<RCTVirtualViewProtocol>)virtualView
112108
{
113109
if (![_virtualViews containsObject:virtualView]) {
114110
[_virtualViews addObject:virtualView];
115-
#if RCT_DEBUG
116-
debugLog(@"Add virtualViewID=%@", virtualView.virtualViewID);
117-
#endif
118-
111+
DEBUG_LOG(@"Add virtualViewID=%@", virtualView.virtualViewID);
119112
} else {
120-
#if RCT_DEBUG
121-
debugLog(@"Update virtualViewID=%@", virtualView.virtualViewID);
122-
#endif
113+
DEBUG_LOG(@"Update virtualViewID=%@", virtualView.virtualViewID);
123114
}
124115
[self _updateModes:virtualView];
125116
}
@@ -131,10 +122,7 @@ - (void)remove:(id<RCTVirtualViewProtocol>)virtualView
131122
}
132123

133124
[_virtualViews removeObject:virtualView];
134-
135-
#if RCT_DEBUG
136-
debugLog(@"Remove virtualViewID=%@", virtualView.virtualViewID);
137-
#endif
125+
DEBUG_LOG(@"Remove virtualViewID=%@", virtualView.virtualViewID);
138126
}
139127

140128
#pragma mark - Private Helpers
@@ -169,14 +157,12 @@ - (void)_updateModes:(id<RCTVirtualViewProtocol>)virtualView
169157
thresholdRect = _prerenderRect;
170158
}
171159

172-
#if RCT_DEBUG
173-
debugLog(
160+
DEBUG_LOG(
174161
@"UpdateModes virtualView=%@ mode=%ld rect=%@ thresholdRect=%@",
175162
vv.virtualViewID,
176163
(long)mode,
177164
NSStringFromCGRect(rect),
178165
NSStringFromCGRect(thresholdRect));
179-
#endif
180166
[vv onModeChange:mode targetRect:rect thresholdRect:thresholdRect];
181167
}
182168
}

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<<3e8cc4e23730f3171824faaf2053bbd9>>
7+
* @generated SignedSource<<f930d8c04c79ad156af580f2818fef24>>
88
*/
99

1010
/**
@@ -336,12 +336,6 @@ public object ReactNativeFeatureFlags {
336336
@JvmStatic
337337
public fun enableVirtualViewContainerStateExperimental(): Boolean = accessor.enableVirtualViewContainerStateExperimental()
338338

339-
/**
340-
* Enables VirtualView debug features such as logging and overlays.
341-
*/
342-
@JvmStatic
343-
public fun enableVirtualViewDebugFeatures(): Boolean = accessor.enableVirtualViewDebugFeatures()
344-
345339
/**
346340
* Fix incorrect parentTag passed as parentTagForUpdate in the unflatten-unflatten branch of calculateShadowViewMutationsFlattener, which causes UPDATE mutations to reference a parent being created in the same batch.
347341
*/

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<<1b877147588a851daaee1a2b4494312a>>
7+
* @generated SignedSource<<5072b83512e1a86dc1382268f18916f4>>
88
*/
99

1010
/**
@@ -71,7 +71,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
7171
private var enableViewRecyclingForTextCache: Boolean? = null
7272
private var enableViewRecyclingForViewCache: Boolean? = null
7373
private var enableVirtualViewContainerStateExperimentalCache: Boolean? = null
74-
private var enableVirtualViewDebugFeaturesCache: Boolean? = null
7574
private var fixDifferentiatorParentTagForUnflattenCaseCache: Boolean? = null
7675
private var fixMappingOfEventPrioritiesBetweenFabricAndReactCache: Boolean? = null
7776
private var fixYogaFlexBasisFitContentInMainAxisCache: Boolean? = null
@@ -568,15 +567,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
568567
return cached
569568
}
570569

571-
override fun enableVirtualViewDebugFeatures(): Boolean {
572-
var cached = enableVirtualViewDebugFeaturesCache
573-
if (cached == null) {
574-
cached = ReactNativeFeatureFlagsCxxInterop.enableVirtualViewDebugFeatures()
575-
enableVirtualViewDebugFeaturesCache = cached
576-
}
577-
return cached
578-
}
579-
580570
override fun fixDifferentiatorParentTagForUnflattenCase(): Boolean {
581571
var cached = fixDifferentiatorParentTagForUnflattenCaseCache
582572
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<<a09de0b0d4b342796ff3fcc1b52fc53a>>
7+
* @generated SignedSource<<9110ccc69266f7a51738ca533df3a150>>
88
*/
99

1010
/**
@@ -130,8 +130,6 @@ public object ReactNativeFeatureFlagsCxxInterop {
130130

131131
@DoNotStrip @JvmStatic public external fun enableVirtualViewContainerStateExperimental(): Boolean
132132

133-
@DoNotStrip @JvmStatic public external fun enableVirtualViewDebugFeatures(): Boolean
134-
135133
@DoNotStrip @JvmStatic public external fun fixDifferentiatorParentTagForUnflattenCase(): Boolean
136134

137135
@DoNotStrip @JvmStatic public external fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): 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<<b08dd880f47d31353cd29e4bcc63090d>>
7+
* @generated SignedSource<<cc3e924846873a6c82f15a81e429a201>>
88
*/
99

1010
/**
@@ -125,8 +125,6 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
125125

126126
override fun enableVirtualViewContainerStateExperimental(): Boolean = false
127127

128-
override fun enableVirtualViewDebugFeatures(): Boolean = false
129-
130128
override fun fixDifferentiatorParentTagForUnflattenCase(): Boolean = false
131129

132130
override fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): 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<<c3cb6a890e22fe2ac279c3a9aa65b096>>
7+
* @generated SignedSource<<135694971d264d19c84eb6aea5fc8425>>
88
*/
99

1010
/**
@@ -75,7 +75,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
7575
private var enableViewRecyclingForTextCache: Boolean? = null
7676
private var enableViewRecyclingForViewCache: Boolean? = null
7777
private var enableVirtualViewContainerStateExperimentalCache: Boolean? = null
78-
private var enableVirtualViewDebugFeaturesCache: Boolean? = null
7978
private var fixDifferentiatorParentTagForUnflattenCaseCache: Boolean? = null
8079
private var fixMappingOfEventPrioritiesBetweenFabricAndReactCache: Boolean? = null
8180
private var fixYogaFlexBasisFitContentInMainAxisCache: Boolean? = null
@@ -623,16 +622,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
623622
return cached
624623
}
625624

626-
override fun enableVirtualViewDebugFeatures(): Boolean {
627-
var cached = enableVirtualViewDebugFeaturesCache
628-
if (cached == null) {
629-
cached = currentProvider.enableVirtualViewDebugFeatures()
630-
accessedFeatureFlags.add("enableVirtualViewDebugFeatures")
631-
enableVirtualViewDebugFeaturesCache = cached
632-
}
633-
return cached
634-
}
635-
636625
override fun fixDifferentiatorParentTagForUnflattenCase(): Boolean {
637626
var cached = fixDifferentiatorParentTagForUnflattenCaseCache
638627
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<<1348346948cf4212dd312c48b5bfe917>>
7+
* @generated SignedSource<<c578ce107e944645965622c45645ac2d>>
88
*/
99

1010
/**
@@ -125,8 +125,6 @@ public interface ReactNativeFeatureFlagsProvider {
125125

126126
@DoNotStrip public fun enableVirtualViewContainerStateExperimental(): Boolean
127127

128-
@DoNotStrip public fun enableVirtualViewDebugFeatures(): Boolean
129-
130128
@DoNotStrip public fun fixDifferentiatorParentTagForUnflattenCase(): Boolean
131129

132130
@DoNotStrip public fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean

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

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ package com.facebook.react.views.scroll
99

1010
import android.graphics.Rect
1111
import android.view.ViewGroup
12-
import com.facebook.common.logging.FLog
13-
import com.facebook.react.common.build.ReactBuildConfig
1412
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags
1513
import com.facebook.react.views.virtual.VirtualViewMode
1614
import java.util.*
@@ -69,24 +67,18 @@ internal abstract class VirtualViewContainerState {
6967
}
7068

7169
open fun onChange(virtualView: VirtualView) {
72-
if (virtualViews.add(virtualView)) {
73-
debugLog("add", { "virtualViewID=${virtualView.virtualViewID}" })
74-
} else {
75-
debugLog("update", { "virtualViewID=${virtualView.virtualViewID}" })
76-
}
70+
virtualViews.add(virtualView)
7771
updateModes(virtualView)
7872
}
7973

8074
open fun remove(virtualView: VirtualView) {
8175
assert(virtualViews.remove(virtualView)) {
8276
"Attempting to remove non-existent VirtualView: ${virtualView.virtualViewID}"
8377
}
84-
debugLog("remove", { "virtualViewID=${virtualView.virtualViewID}" })
8578
}
8679

8780
// Called on ScrollView onLayout or onScroll
8881
fun updateState() {
89-
debugLog("updateState")
9082
updateModes()
9183
}
9284

@@ -98,7 +90,6 @@ internal abstract class VirtualViewContainerState {
9890
// intentionally goes but curently ScrollView and v1 Fling use this check to determine if
9991
// "content ready"
10092
if (visibleRect.isEmpty()) {
101-
debugLog("updateRects", { "scrollView visibleRect is empty" })
10293
// should set the other rects here in case scrollview is suddenly empty after the other rects
10394
// are non-empty
10495
prerenderRect.set(visibleRect)
@@ -110,22 +101,7 @@ internal abstract class VirtualViewContainerState {
110101
(-prerenderRect.width() * prerenderRatio).toInt(),
111102
(-prerenderRect.height() * prerenderRatio).toInt(),
112103
)
113-
114-
debugLog(
115-
"updateRects",
116-
{ "visibleRect ${visibleRect.toString()} prerenderRect ${prerenderRect.toString()}" },
117-
)
118104
}
119105

120106
protected abstract fun updateModes(virtualView: VirtualView? = null)
121107
}
122-
123-
private const val DEBUG_TAG: String = "VirtualViewContainerState"
124-
internal val IS_DEBUG_BUILD =
125-
ReactBuildConfig.DEBUG || ReactBuildConfig.IS_INTERNAL_BUILD || ReactBuildConfig.ENABLE_PERFETTO
126-
127-
private inline fun debugLog(subtag: String, block: () -> String = { "" }) {
128-
if (IS_DEBUG_BUILD && ReactNativeFeatureFlags.enableVirtualViewDebugFeatures()) {
129-
FLog.d("$DEBUG_TAG:$subtag", block())
130-
}
131-
}

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

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

1010
import android.view.ViewGroup
1111
import com.facebook.common.logging.FLog
12-
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags
12+
import com.facebook.react.common.build.ReactBuildConfig
1313
import com.facebook.react.views.virtual.VirtualViewMode
1414

1515
internal class VirtualViewContainerStateClassic(scrollView: ViewGroup) :
@@ -58,12 +58,14 @@ internal class VirtualViewContainerStateClassic(scrollView: ViewGroup) :
5858
)
5959
}
6060
}
61-
}
6261

63-
private const val DEBUG_TAG: String = "VirtualViewContainerStateClassic"
62+
internal companion object {
63+
private val ENABLE_DEBUG_LOGS = ReactBuildConfig.DEBUG && false
6464

65-
private inline fun debugLog(subtag: String, block: () -> String = { "" }) {
66-
if (IS_DEBUG_BUILD && ReactNativeFeatureFlags.enableVirtualViewDebugFeatures()) {
67-
FLog.d("$DEBUG_TAG:$subtag", block())
65+
internal inline fun debugLog(subtag: String, block: () -> String = { "" }) {
66+
if (ENABLE_DEBUG_LOGS) {
67+
FLog.d("VirtualViewContainerStateClassic:$subtag", block())
68+
}
69+
}
6870
}
6971
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ package com.facebook.react.views.scroll
1010
import android.graphics.Rect
1111
import android.view.ViewGroup
1212
import com.facebook.common.logging.FLog
13-
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags
13+
import com.facebook.react.common.build.ReactBuildConfig
1414
import com.facebook.react.views.virtual.VirtualViewMode
1515

1616
internal class VirtualViewContainerStateExperimental(scrollView: ViewGroup) :
@@ -503,10 +503,10 @@ internal class IntervalTree(private val horizontal: Boolean) : MutableCollection
503503
}
504504
}
505505

506-
private const val DEBUG_TAG: String = "VirtualViewContainerStateExperimental"
506+
private val ENABLE_DEBUG_LOGS = ReactBuildConfig.DEBUG && false
507507

508508
private inline fun debugLog(subtag: String, block: () -> String = { "" }) {
509-
if (IS_DEBUG_BUILD && ReactNativeFeatureFlags.enableVirtualViewDebugFeatures()) {
510-
FLog.d("$DEBUG_TAG:$subtag", block())
509+
if (ENABLE_DEBUG_LOGS) {
510+
FLog.d("VirtualViewContainerStateExperimental:$subtag", block())
511511
}
512512
}

0 commit comments

Comments
 (0)