From 103f387f22a25cc25e30a3194870ff0f174c4db4 Mon Sep 17 00:00:00 2001 From: Tim Yung Date: Tue, 24 Jun 2025 23:07:43 -0700 Subject: [PATCH] VirtualView: Minimize Events w/ Render State (#52245) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/52245 Changes `VirtualView` to avoid dispatching redundant mode change events by reading the last committed `renderState` to determine whether the desired render state is already in effect. This enables `VirtualView` to avoid dispatching synchronous `Visible` mode change events when a previous `Prerender` mode change event has already been committed. Changelog: [Internal] Reviewed By: lunaleaps Differential Revision: D77271865 --- .../RCTVirtualViewComponentView.mm | 39 ++++++++++++++- .../ReactAndroid/api/ReactAndroid.api | 1 + .../featureflags/ReactNativeFeatureFlags.kt | 8 ++- .../ReactNativeFeatureFlagsCxxAccessor.kt | 12 ++++- .../ReactNativeFeatureFlagsCxxInterop.kt | 4 +- .../ReactNativeFeatureFlagsDefaults.kt | 4 +- .../ReactNativeFeatureFlagsLocalAccessor.kt | 13 ++++- .../ReactNativeFeatureFlagsProvider.kt | 4 +- .../views/virtualview/ReactVirtualView.kt | 14 +++++- .../virtualview/ReactVirtualViewManager.kt | 14 ++++++ .../virtualview/VirtualViewRenderState.kt | 20 ++++++++ .../JReactNativeFeatureFlagsCxxInterop.cpp | 16 +++++- .../JReactNativeFeatureFlagsCxxInterop.h | 5 +- .../featureflags/ReactNativeFeatureFlags.cpp | 6 ++- .../featureflags/ReactNativeFeatureFlags.h | 7 ++- .../ReactNativeFeatureFlagsAccessor.cpp | 50 +++++++++++++------ .../ReactNativeFeatureFlagsAccessor.h | 6 ++- .../ReactNativeFeatureFlagsDefaults.h | 6 ++- .../ReactNativeFeatureFlagsDynamicProvider.h | 11 +++- .../ReactNativeFeatureFlagsProvider.h | 3 +- .../NativeReactNativeFeatureFlags.cpp | 7 ++- .../NativeReactNativeFeatureFlags.h | 4 +- .../ReactNativeFeatureFlags.config.js | 10 ++++ .../components/virtualview/VirtualView.js | 12 +++++ .../virtualview/VirtualViewNativeComponent.js | 22 ++++++-- .../featureflags/ReactNativeFeatureFlags.js | 7 ++- .../specs/NativeReactNativeFeatureFlags.js | 3 +- 27 files changed, 267 insertions(+), 41 deletions(-) create mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/virtualview/VirtualViewRenderState.kt diff --git a/packages/react-native/React/Fabric/Mounting/ComponentViews/VirtualView/RCTVirtualViewComponentView.mm b/packages/react-native/React/Fabric/Mounting/ComponentViews/VirtualView/RCTVirtualViewComponentView.mm index 7fde324200bf..57645a95e3aa 100644 --- a/packages/react-native/React/Fabric/Mounting/ComponentViews/VirtualView/RCTVirtualViewComponentView.mm +++ b/packages/react-native/React/Fabric/Mounting/ComponentViews/VirtualView/RCTVirtualViewComponentView.mm @@ -32,6 +32,12 @@ typedef NS_ENUM(NSInteger, RCTVirtualViewMode) { RCTVirtualViewModeHidden = 2, }; +typedef NS_ENUM(NSInteger, RCTVirtualViewRenderState) { + RCTVirtualViewRenderStateUnknown = 0, + RCTVirtualViewRenderStateRendered = 1, + RCTVirtualViewRenderStateNone = 2, +}; + /** * Checks whether one CGRect overlaps with another CGRect. * @@ -67,6 +73,7 @@ @interface RCTVirtualViewComponentView () @implementation RCTVirtualViewComponentView { RCTScrollViewComponentView *_lastParentScrollViewComponentView; std::optional _mode; + enum RCTVirtualViewRenderState _renderState; std::optional _targetRect; } @@ -74,6 +81,7 @@ - (instancetype)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { _props = VirtualViewShadowNode::defaultSharedProps(); + _renderState = RCTVirtualViewRenderStateUnknown; } return self; @@ -81,11 +89,27 @@ - (instancetype)initWithFrame:(CGRect)frame - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &)oldProps { + const auto &newViewProps = static_cast(*props); + if (!_mode.has_value()) { - const auto &newViewProps = static_cast(*props); _mode = newViewProps.initialHidden ? RCTVirtualViewModeHidden : RCTVirtualViewModeVisible; } + // If disabled, `_renderState` will always be `RCTVirtualViewRenderStateUnknown`. + if (ReactNativeFeatureFlags::enableVirtualViewRenderState()) { + switch (newViewProps.renderState) { + case 1: + _renderState = RCTVirtualViewRenderStateRendered; + break; + case 2: + _renderState = RCTVirtualViewRenderStateNone; + break; + default: + _renderState = RCTVirtualViewRenderStateUnknown; + break; + } + } + [super updateProps:props oldProps:oldProps]; } @@ -219,7 +243,18 @@ - (void)dispatchOnModeChangeIfNeeded:(BOOL)checkForTargetRectChange switch (newMode) { case RCTVirtualViewModeVisible: - [self dispatchSyncModeChange:event]; + if (_renderState == RCTVirtualViewRenderStateUnknown) { + // Feature flag is disabled, so use the former logic. + [self dispatchSyncModeChange:event]; + } else { + // If the previous mode was prerender and the result of dispatching that event was committed, we do not need to + // dispatch an event for visible. + const auto wasPrerenderCommitted = oldMode.has_value() && oldMode == RCTVirtualViewModePrerender && + _renderState == RCTVirtualViewRenderStateRendered; + if (!wasPrerenderCommitted) { + [self dispatchSyncModeChange:event]; + } + } break; case RCTVirtualViewModePrerender: if (!oldMode.has_value() || oldMode != RCTVirtualViewModeVisible) { diff --git a/packages/react-native/ReactAndroid/api/ReactAndroid.api b/packages/react-native/ReactAndroid/api/ReactAndroid.api index 88e9c1ce3c98..8a4d555e0cd4 100644 --- a/packages/react-native/ReactAndroid/api/ReactAndroid.api +++ b/packages/react-native/ReactAndroid/api/ReactAndroid.api @@ -5290,6 +5290,7 @@ public class com/facebook/react/viewmanagers/VirtualViewManagerDelegate : com/fa public abstract interface class com/facebook/react/viewmanagers/VirtualViewManagerInterface : com/facebook/react/uimanager/ViewManagerWithGeneratedInterface { public abstract fun setInitialHidden (Landroid/view/View;Z)V + public abstract fun setRenderState (Landroid/view/View;I)V } public final class com/facebook/react/views/drawer/ReactDrawerLayout : androidx/drawerlayout/widget/DrawerLayout { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt index cd070f14f777..a9bf17f7e592 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<7d9248932099e75eb56ed8b7409b764e>> + * @generated SignedSource<<442cbf571b5654c5d322ca1b5542db7d>> */ /** @@ -258,6 +258,12 @@ public object ReactNativeFeatureFlags { @JvmStatic public fun enableVirtualViewDebugFeatures(): Boolean = accessor.enableVirtualViewDebugFeatures() + /** + * Enables reading render state when dispatching VirtualView events. + */ + @JvmStatic + public fun enableVirtualViewRenderState(): Boolean = accessor.enableVirtualViewRenderState() + /** * Enables window focus detection for prioritizing VirtualView events. */ diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt index a3a4091d23f8..52c265d8c7e8 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<04fa992cf8fec2d89a49cc03bc3f7757>> + * @generated SignedSource<<166a7cc18f83861c6c4d7f96a55c5843>> */ /** @@ -58,6 +58,7 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces private var enableViewRecyclingForTextCache: Boolean? = null private var enableViewRecyclingForViewCache: Boolean? = null private var enableVirtualViewDebugFeaturesCache: Boolean? = null + private var enableVirtualViewRenderStateCache: Boolean? = null private var enableVirtualViewWindowFocusDetectionCache: Boolean? = null private var fixMappingOfEventPrioritiesBetweenFabricAndReactCache: Boolean? = null private var fuseboxEnabledReleaseCache: Boolean? = null @@ -416,6 +417,15 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces return cached } + override fun enableVirtualViewRenderState(): Boolean { + var cached = enableVirtualViewRenderStateCache + if (cached == null) { + cached = ReactNativeFeatureFlagsCxxInterop.enableVirtualViewRenderState() + enableVirtualViewRenderStateCache = cached + } + return cached + } + override fun enableVirtualViewWindowFocusDetection(): Boolean { var cached = enableVirtualViewWindowFocusDetectionCache if (cached == null) { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt index 428c94b870ce..d420ea138ef8 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<89ffcb75b9b94600174ba8a704314a69>> + * @generated SignedSource<<27e8fa8139901c1decaba5bfcbced221>> */ /** @@ -104,6 +104,8 @@ public object ReactNativeFeatureFlagsCxxInterop { @DoNotStrip @JvmStatic public external fun enableVirtualViewDebugFeatures(): Boolean + @DoNotStrip @JvmStatic public external fun enableVirtualViewRenderState(): Boolean + @DoNotStrip @JvmStatic public external fun enableVirtualViewWindowFocusDetection(): Boolean @DoNotStrip @JvmStatic public external fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt index f82020a0a6a9..eb21bbf06a9d 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<<5efae3bf30e8acf69f0682372c39f7b2>> */ /** @@ -99,6 +99,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi override fun enableVirtualViewDebugFeatures(): Boolean = false + override fun enableVirtualViewRenderState(): Boolean = false + override fun enableVirtualViewWindowFocusDetection(): Boolean = false override fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean = false diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt index 0133c0362bc4..a0f67ac2c312 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<466ed58fa72b8d114887bb0a4931aa18>> + * @generated SignedSource<<498e9a51a9a0d0c0c4eb69c84bb33dd1>> */ /** @@ -62,6 +62,7 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc private var enableViewRecyclingForTextCache: Boolean? = null private var enableViewRecyclingForViewCache: Boolean? = null private var enableVirtualViewDebugFeaturesCache: Boolean? = null + private var enableVirtualViewRenderStateCache: Boolean? = null private var enableVirtualViewWindowFocusDetectionCache: Boolean? = null private var fixMappingOfEventPrioritiesBetweenFabricAndReactCache: Boolean? = null private var fuseboxEnabledReleaseCache: Boolean? = null @@ -458,6 +459,16 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc return cached } + override fun enableVirtualViewRenderState(): Boolean { + var cached = enableVirtualViewRenderStateCache + if (cached == null) { + cached = currentProvider.enableVirtualViewRenderState() + accessedFeatureFlags.add("enableVirtualViewRenderState") + enableVirtualViewRenderStateCache = cached + } + return cached + } + override fun enableVirtualViewWindowFocusDetection(): Boolean { var cached = enableVirtualViewWindowFocusDetectionCache if (cached == null) { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt index 7f5431cab3ad..eb3f761c98f0 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<> */ /** @@ -99,6 +99,8 @@ public interface ReactNativeFeatureFlagsProvider { @DoNotStrip public fun enableVirtualViewDebugFeatures(): Boolean + @DoNotStrip public fun enableVirtualViewRenderState(): Boolean + @DoNotStrip public fun enableVirtualViewWindowFocusDetection(): Boolean @DoNotStrip public fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/virtualview/ReactVirtualView.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/virtualview/ReactVirtualView.kt index 063c00f86c5a..7a0d4d1f8983 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/virtualview/ReactVirtualView.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/virtualview/ReactVirtualView.kt @@ -33,6 +33,7 @@ internal class ReactVirtualView(context: Context) : View.OnLayoutChangeListener { internal var mode: VirtualViewMode? = null + internal var renderState: VirtualViewRenderState = VirtualViewRenderState.Unknown internal var modeChangeEmitter: ModeChangeEmitter? = null internal var prerenderRatio: Double = ReactNativeFeatureFlags.virtualViewPrerenderRatio() internal val debugLogEnabled: Boolean = ReactNativeFeatureFlags.enableVirtualViewDebugFeatures() @@ -267,7 +268,18 @@ internal class ReactVirtualView(context: Context) : "VirtualView::mode change $oldMode -> $newMode, nativeID=$nativeId") when (newMode) { VirtualViewMode.Visible -> { - emitSyncModeChange(VirtualViewMode.Visible) + if (renderState == VirtualViewRenderState.Unknown) { + // Feature flag is disabled, so use the former logic. + emitSyncModeChange(VirtualViewMode.Visible) + } else { + // If the previous mode was prerender and the result of dispatching that event was + // committed, we do not need to dispatch an event for visible. + val wasPrerenderCommitted = + oldMode == VirtualViewMode.Prerender && renderState == VirtualViewRenderState.Rendered + if (!wasPrerenderCommitted) { + emitSyncModeChange(VirtualViewMode.Visible) + } + } } VirtualViewMode.Prerender -> { if (oldMode != VirtualViewMode.Visible) { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/virtualview/ReactVirtualViewManager.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/virtualview/ReactVirtualViewManager.kt index b877b928a3ed..9c9e2219d856 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/virtualview/ReactVirtualViewManager.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/virtualview/ReactVirtualViewManager.kt @@ -9,6 +9,7 @@ package com.facebook.react.views.virtualview import android.graphics.Rect import androidx.annotation.VisibleForTesting +import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags import com.facebook.react.module.annotations.ReactModule import com.facebook.react.uimanager.ThemedReactContext import com.facebook.react.uimanager.UIManagerHelper @@ -39,6 +40,19 @@ internal class ReactVirtualViewManager : } } + @ReactProp(name = "renderState") + override fun setRenderState(view: ReactVirtualView, value: Int) { + // If disabled, `renderState` will always be `VirtualViewRenderState.Unknown`. + if (ReactNativeFeatureFlags.enableVirtualViewRenderState()) { + view.renderState = + when (value) { + 1 -> VirtualViewRenderState.Rendered + 2 -> VirtualViewRenderState.None + else -> VirtualViewRenderState.Unknown + } + } + } + override fun setNativeId(view: ReactVirtualView, nativeId: String?) { super.setNativeId(view, nativeId) view.debugLog("setNativeId") { "${view.id}" } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/virtualview/VirtualViewRenderState.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/virtualview/VirtualViewRenderState.kt new file mode 100644 index 000000000000..aa7ad65d5e27 --- /dev/null +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/virtualview/VirtualViewRenderState.kt @@ -0,0 +1,20 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +package com.facebook.react.views.virtualview + +/** + * Represents the the render state of children in the most recent commit. + * + * This enables `ReactVirtualView` to know whether a previously emitted `VirtualViewModeChangeEvent` + * has been committed, in order to only emit subsequent events that would change it. + */ +internal enum class VirtualViewRenderState(val value: Int) { + Unknown(0), + Rendered(1), + None(2), +} diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp index 0cad7d004145..76165d59e121 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp +++ b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<8f4c2b4cd9f25778e0809c1261aa4728>> + * @generated SignedSource<<04d1e45bd61df19a284947523172bf4a>> */ /** @@ -267,6 +267,12 @@ class ReactNativeFeatureFlagsJavaProvider return method(javaProvider_); } + bool enableVirtualViewRenderState() override { + static const auto method = + getReactNativeFeatureFlagsProviderJavaClass()->getMethod("enableVirtualViewRenderState"); + return method(javaProvider_); + } + bool enableVirtualViewWindowFocusDetection() override { static const auto method = getReactNativeFeatureFlagsProviderJavaClass()->getMethod("enableVirtualViewWindowFocusDetection"); @@ -551,6 +557,11 @@ bool JReactNativeFeatureFlagsCxxInterop::enableVirtualViewDebugFeatures( return ReactNativeFeatureFlags::enableVirtualViewDebugFeatures(); } +bool JReactNativeFeatureFlagsCxxInterop::enableVirtualViewRenderState( + facebook::jni::alias_ref /*unused*/) { + return ReactNativeFeatureFlags::enableVirtualViewRenderState(); +} + bool JReactNativeFeatureFlagsCxxInterop::enableVirtualViewWindowFocusDetection( facebook::jni::alias_ref /*unused*/) { return ReactNativeFeatureFlags::enableVirtualViewWindowFocusDetection(); @@ -771,6 +782,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() { makeNativeMethod( "enableVirtualViewDebugFeatures", JReactNativeFeatureFlagsCxxInterop::enableVirtualViewDebugFeatures), + makeNativeMethod( + "enableVirtualViewRenderState", + JReactNativeFeatureFlagsCxxInterop::enableVirtualViewRenderState), makeNativeMethod( "enableVirtualViewWindowFocusDetection", JReactNativeFeatureFlagsCxxInterop::enableVirtualViewWindowFocusDetection), diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h index b1b021fd660d..704370079467 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h +++ b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<> */ /** @@ -144,6 +144,9 @@ class JReactNativeFeatureFlagsCxxInterop static bool enableVirtualViewDebugFeatures( facebook::jni::alias_ref); + static bool enableVirtualViewRenderState( + facebook::jni::alias_ref); + static bool enableVirtualViewWindowFocusDetection( facebook::jni::alias_ref); diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp index d2db0ab0aaf7..0cf2e9e15b6c 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<74d7512ad4e33dd4ba58cdf1da104173>> + * @generated SignedSource<> */ /** @@ -178,6 +178,10 @@ bool ReactNativeFeatureFlags::enableVirtualViewDebugFeatures() { return getAccessor().enableVirtualViewDebugFeatures(); } +bool ReactNativeFeatureFlags::enableVirtualViewRenderState() { + return getAccessor().enableVirtualViewRenderState(); +} + bool ReactNativeFeatureFlags::enableVirtualViewWindowFocusDetection() { return getAccessor().enableVirtualViewWindowFocusDetection(); } diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h index dbbb941c926d..d55323de9416 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<> */ /** @@ -229,6 +229,11 @@ class ReactNativeFeatureFlags { */ RN_EXPORT static bool enableVirtualViewDebugFeatures(); + /** + * Enables reading render state when dispatching VirtualView events. + */ + RN_EXPORT static bool enableVirtualViewRenderState(); + /** * Enables window focus detection for prioritizing VirtualView events. */ diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp index 90a3d740fc1a..7588c80bdc27 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<7879ae2d1feddc95f43baddde963383a>> + * @generated SignedSource<> */ /** @@ -713,6 +713,24 @@ bool ReactNativeFeatureFlagsAccessor::enableVirtualViewDebugFeatures() { return flagValue.value(); } +bool ReactNativeFeatureFlagsAccessor::enableVirtualViewRenderState() { + auto flagValue = enableVirtualViewRenderState_.load(); + + if (!flagValue.has_value()) { + // This block is not exclusive but it is not necessary. + // If multiple threads try to initialize the feature flag, we would only + // be accessing the provider multiple times but the end state of this + // instance and the returned flag value would be the same. + + markFlagAsAccessed(38, "enableVirtualViewRenderState"); + + flagValue = currentProvider_->enableVirtualViewRenderState(); + enableVirtualViewRenderState_ = flagValue; + } + + return flagValue.value(); +} + bool ReactNativeFeatureFlagsAccessor::enableVirtualViewWindowFocusDetection() { auto flagValue = enableVirtualViewWindowFocusDetection_.load(); @@ -722,7 +740,7 @@ bool ReactNativeFeatureFlagsAccessor::enableVirtualViewWindowFocusDetection() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(38, "enableVirtualViewWindowFocusDetection"); + markFlagAsAccessed(39, "enableVirtualViewWindowFocusDetection"); flagValue = currentProvider_->enableVirtualViewWindowFocusDetection(); enableVirtualViewWindowFocusDetection_ = flagValue; @@ -740,7 +758,7 @@ bool ReactNativeFeatureFlagsAccessor::fixMappingOfEventPrioritiesBetweenFabricAn // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(39, "fixMappingOfEventPrioritiesBetweenFabricAndReact"); + markFlagAsAccessed(40, "fixMappingOfEventPrioritiesBetweenFabricAndReact"); flagValue = currentProvider_->fixMappingOfEventPrioritiesBetweenFabricAndReact(); fixMappingOfEventPrioritiesBetweenFabricAndReact_ = flagValue; @@ -758,7 +776,7 @@ bool ReactNativeFeatureFlagsAccessor::fuseboxEnabledRelease() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(40, "fuseboxEnabledRelease"); + markFlagAsAccessed(41, "fuseboxEnabledRelease"); flagValue = currentProvider_->fuseboxEnabledRelease(); fuseboxEnabledRelease_ = flagValue; @@ -776,7 +794,7 @@ bool ReactNativeFeatureFlagsAccessor::fuseboxNetworkInspectionEnabled() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(41, "fuseboxNetworkInspectionEnabled"); + markFlagAsAccessed(42, "fuseboxNetworkInspectionEnabled"); flagValue = currentProvider_->fuseboxNetworkInspectionEnabled(); fuseboxNetworkInspectionEnabled_ = flagValue; @@ -794,7 +812,7 @@ bool ReactNativeFeatureFlagsAccessor::traceTurboModulePromiseRejectionsOnAndroid // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(42, "traceTurboModulePromiseRejectionsOnAndroid"); + markFlagAsAccessed(43, "traceTurboModulePromiseRejectionsOnAndroid"); flagValue = currentProvider_->traceTurboModulePromiseRejectionsOnAndroid(); traceTurboModulePromiseRejectionsOnAndroid_ = flagValue; @@ -812,7 +830,7 @@ bool ReactNativeFeatureFlagsAccessor::updateRuntimeShadowNodeReferencesOnCommit( // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(43, "updateRuntimeShadowNodeReferencesOnCommit"); + markFlagAsAccessed(44, "updateRuntimeShadowNodeReferencesOnCommit"); flagValue = currentProvider_->updateRuntimeShadowNodeReferencesOnCommit(); updateRuntimeShadowNodeReferencesOnCommit_ = flagValue; @@ -830,7 +848,7 @@ bool ReactNativeFeatureFlagsAccessor::useAlwaysAvailableJSErrorHandling() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(44, "useAlwaysAvailableJSErrorHandling"); + markFlagAsAccessed(45, "useAlwaysAvailableJSErrorHandling"); flagValue = currentProvider_->useAlwaysAvailableJSErrorHandling(); useAlwaysAvailableJSErrorHandling_ = flagValue; @@ -848,7 +866,7 @@ bool ReactNativeFeatureFlagsAccessor::useFabricInterop() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(45, "useFabricInterop"); + markFlagAsAccessed(46, "useFabricInterop"); flagValue = currentProvider_->useFabricInterop(); useFabricInterop_ = flagValue; @@ -866,7 +884,7 @@ bool ReactNativeFeatureFlagsAccessor::useNativeViewConfigsInBridgelessMode() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(46, "useNativeViewConfigsInBridgelessMode"); + markFlagAsAccessed(47, "useNativeViewConfigsInBridgelessMode"); flagValue = currentProvider_->useNativeViewConfigsInBridgelessMode(); useNativeViewConfigsInBridgelessMode_ = flagValue; @@ -884,7 +902,7 @@ bool ReactNativeFeatureFlagsAccessor::useOptimizedEventBatchingOnAndroid() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(47, "useOptimizedEventBatchingOnAndroid"); + markFlagAsAccessed(48, "useOptimizedEventBatchingOnAndroid"); flagValue = currentProvider_->useOptimizedEventBatchingOnAndroid(); useOptimizedEventBatchingOnAndroid_ = flagValue; @@ -902,7 +920,7 @@ bool ReactNativeFeatureFlagsAccessor::useRawPropsJsiValue() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(48, "useRawPropsJsiValue"); + markFlagAsAccessed(49, "useRawPropsJsiValue"); flagValue = currentProvider_->useRawPropsJsiValue(); useRawPropsJsiValue_ = flagValue; @@ -920,7 +938,7 @@ bool ReactNativeFeatureFlagsAccessor::useShadowNodeStateOnClone() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(49, "useShadowNodeStateOnClone"); + markFlagAsAccessed(50, "useShadowNodeStateOnClone"); flagValue = currentProvider_->useShadowNodeStateOnClone(); useShadowNodeStateOnClone_ = flagValue; @@ -938,7 +956,7 @@ bool ReactNativeFeatureFlagsAccessor::useTurboModuleInterop() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(50, "useTurboModuleInterop"); + markFlagAsAccessed(51, "useTurboModuleInterop"); flagValue = currentProvider_->useTurboModuleInterop(); useTurboModuleInterop_ = flagValue; @@ -956,7 +974,7 @@ bool ReactNativeFeatureFlagsAccessor::useTurboModules() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(51, "useTurboModules"); + markFlagAsAccessed(52, "useTurboModules"); flagValue = currentProvider_->useTurboModules(); useTurboModules_ = flagValue; @@ -974,7 +992,7 @@ double ReactNativeFeatureFlagsAccessor::virtualViewPrerenderRatio() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(52, "virtualViewPrerenderRatio"); + markFlagAsAccessed(53, "virtualViewPrerenderRatio"); flagValue = currentProvider_->virtualViewPrerenderRatio(); virtualViewPrerenderRatio_ = flagValue; diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h index 583780a8d48a..1e8ec3f4b628 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<9f79030f701c83f2838f4a121c0c9aaf>> + * @generated SignedSource<<95e236c60bfd2353e91b8ed025040cac>> */ /** @@ -70,6 +70,7 @@ class ReactNativeFeatureFlagsAccessor { bool enableViewRecyclingForText(); bool enableViewRecyclingForView(); bool enableVirtualViewDebugFeatures(); + bool enableVirtualViewRenderState(); bool enableVirtualViewWindowFocusDetection(); bool fixMappingOfEventPrioritiesBetweenFabricAndReact(); bool fuseboxEnabledRelease(); @@ -96,7 +97,7 @@ class ReactNativeFeatureFlagsAccessor { std::unique_ptr currentProvider_; bool wasOverridden_; - std::array, 53> accessedFeatureFlags_; + std::array, 54> accessedFeatureFlags_; std::atomic> commonTestFlag_; std::atomic> animatedShouldSignalBatch_; @@ -136,6 +137,7 @@ class ReactNativeFeatureFlagsAccessor { std::atomic> enableViewRecyclingForText_; std::atomic> enableViewRecyclingForView_; std::atomic> enableVirtualViewDebugFeatures_; + std::atomic> enableVirtualViewRenderState_; std::atomic> enableVirtualViewWindowFocusDetection_; std::atomic> fixMappingOfEventPrioritiesBetweenFabricAndReact_; std::atomic> fuseboxEnabledRelease_; diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h index c827a3cc98ee..b73dff7b0724 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<<434949abb158475ec4304517eb5c4eb8>> */ /** @@ -179,6 +179,10 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider { return false; } + bool enableVirtualViewRenderState() override { + return false; + } + bool enableVirtualViewWindowFocusDetection() override { return false; } diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h index b9a1f9c1baf2..83c60b605585 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<2e71beed1f8714baf19f8d78583b24a8>> + * @generated SignedSource<> */ /** @@ -387,6 +387,15 @@ class ReactNativeFeatureFlagsDynamicProvider : public ReactNativeFeatureFlagsDef return ReactNativeFeatureFlagsDefaults::enableVirtualViewDebugFeatures(); } + bool enableVirtualViewRenderState() override { + auto value = values_["enableVirtualViewRenderState"]; + if (!value.isNull()) { + return value.getBool(); + } + + return ReactNativeFeatureFlagsDefaults::enableVirtualViewRenderState(); + } + bool enableVirtualViewWindowFocusDetection() override { auto value = values_["enableVirtualViewWindowFocusDetection"]; if (!value.isNull()) { diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h index 82a76e33a5ac..5dca6d7b91ca 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<> */ /** @@ -63,6 +63,7 @@ class ReactNativeFeatureFlagsProvider { virtual bool enableViewRecyclingForText() = 0; virtual bool enableViewRecyclingForView() = 0; virtual bool enableVirtualViewDebugFeatures() = 0; + virtual bool enableVirtualViewRenderState() = 0; virtual bool enableVirtualViewWindowFocusDetection() = 0; virtual bool fixMappingOfEventPrioritiesBetweenFabricAndReact() = 0; virtual bool fuseboxEnabledRelease() = 0; diff --git a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp index 3d927cb71a84..3270ff11ee6e 100644 --- a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp +++ b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<619c621561b48d04735821ff756f4d1c>> + * @generated SignedSource<> */ /** @@ -234,6 +234,11 @@ bool NativeReactNativeFeatureFlags::enableVirtualViewDebugFeatures( return ReactNativeFeatureFlags::enableVirtualViewDebugFeatures(); } +bool NativeReactNativeFeatureFlags::enableVirtualViewRenderState( + jsi::Runtime& /*runtime*/) { + return ReactNativeFeatureFlags::enableVirtualViewRenderState(); +} + bool NativeReactNativeFeatureFlags::enableVirtualViewWindowFocusDetection( jsi::Runtime& /*runtime*/) { return ReactNativeFeatureFlags::enableVirtualViewWindowFocusDetection(); diff --git a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h index 665ea27b0ae2..5c4737d787f3 100644 --- a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h +++ b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<9c887a11347802fd246b76f1ccfd7eb9>> + * @generated SignedSource<<122fa0ad54c810e7fa844309a9b4fbd6>> */ /** @@ -112,6 +112,8 @@ class NativeReactNativeFeatureFlags bool enableVirtualViewDebugFeatures(jsi::Runtime& runtime); + bool enableVirtualViewRenderState(jsi::Runtime& runtime); + bool enableVirtualViewWindowFocusDetection(jsi::Runtime& runtime); bool fixMappingOfEventPrioritiesBetweenFabricAndReact(jsi::Runtime& runtime); diff --git a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js index af91f3bd76ce..975ee5275c1d 100644 --- a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js +++ b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js @@ -448,6 +448,16 @@ const definitions: FeatureFlagDefinitions = { }, ossReleaseStage: 'none', }, + enableVirtualViewRenderState: { + defaultValue: false, + metadata: { + description: + 'Enables reading render state when dispatching VirtualView events.', + expectedReleaseValue: true, + purpose: 'operational', + }, + ossReleaseStage: 'none', + }, enableVirtualViewWindowFocusDetection: { defaultValue: false, metadata: { diff --git a/packages/react-native/src/private/components/virtualview/VirtualView.js b/packages/react-native/src/private/components/virtualview/VirtualView.js index 5a3579172ae9..051e596f6a00 100644 --- a/packages/react-native/src/private/components/virtualview/VirtualView.js +++ b/packages/react-native/src/private/components/virtualview/VirtualView.js @@ -26,6 +26,13 @@ export enum VirtualViewMode { Hidden = 2, } +// @see VirtualViewNativeComponent +export enum VirtualViewRenderState { + Unknown = 0, + Rendered = 1, + None = 2, +} + export type Rect = $ReadOnly<{ x: number, y: number, @@ -109,6 +116,11 @@ function createVirtualView(initialState: State): VirtualViewComponent { initialHidden={initialHidden} nativeID={nativeID} ref={ref} + renderState={ + (isHidden + ? VirtualViewRenderState.None + : VirtualViewRenderState.Rendered) as number + } style={ isHidden ? StyleSheet.compose(style, { diff --git a/packages/react-native/src/private/components/virtualview/VirtualViewNativeComponent.js b/packages/react-native/src/private/components/virtualview/VirtualViewNativeComponent.js index e7c1df5424c3..f14da55205b6 100644 --- a/packages/react-native/src/private/components/virtualview/VirtualViewNativeComponent.js +++ b/packages/react-native/src/private/components/virtualview/VirtualViewNativeComponent.js @@ -22,7 +22,7 @@ export type NativeModeChangeEvent = $ReadOnly<{ /** * Virtualization mode of the target view. * - * - `0`: Target view is visible. (default) + * - `0`: Target view is visible. * - `1`: Target view is hidden, but can be prerendered. * - `2`: Target view is hidden. * @@ -62,10 +62,26 @@ export type NativeModeChangeEvent = $ReadOnly<{ type VirtualViewNativeProps = $ReadOnly<{ ...ViewProps, - // Whether the initial mode should be `Hidden`. + /** + * Whether the initial mode should be `Hidden`. + */ initialHidden?: boolean, - // Events + /** + * Render state of children. + * + * - `0`: Reserved to represent unknown future values. + * - `1`: Children are rendered. + * - `2`: Children are not rendered. + * + * WORKAROUND: As of this writing, codegen doesn't support enums, so we need + * to convert `number` into an enum in `VirtualView`. + */ + renderState: Int32, + + /** + * See `NativeModeChangeEvent`. + */ onModeChange?: ?DirectEventHandler, }>; diff --git a/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js b/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js index 5de1afaf857f..76af2b17e0ae 100644 --- a/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js +++ b/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<4307e335d9579b44671f4ad296f3009d>> + * @generated SignedSource<> * @flow strict * @noformat */ @@ -88,6 +88,7 @@ export type ReactNativeFeatureFlags = $ReadOnly<{ enableViewRecyclingForText: Getter, enableViewRecyclingForView: Getter, enableVirtualViewDebugFeatures: Getter, + enableVirtualViewRenderState: Getter, enableVirtualViewWindowFocusDetection: Getter, fixMappingOfEventPrioritiesBetweenFabricAndReact: Getter, fuseboxEnabledRelease: Getter, @@ -336,6 +337,10 @@ export const enableViewRecyclingForView: Getter = createNativeFlagGette * Enables VirtualView debug features such as logging and overlays. */ export const enableVirtualViewDebugFeatures: Getter = createNativeFlagGetter('enableVirtualViewDebugFeatures', false); +/** + * Enables reading render state when dispatching VirtualView events. + */ +export const enableVirtualViewRenderState: Getter = createNativeFlagGetter('enableVirtualViewRenderState', false); /** * Enables window focus detection for prioritizing VirtualView events. */ diff --git a/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js b/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js index c01d33248be9..8e040626d115 100644 --- a/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +++ b/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<771265ed0def037a021afb585260a85b>> + * @generated SignedSource<<8486a70271ac65d766d11eaca983ddb8>> * @flow strict * @noformat */ @@ -63,6 +63,7 @@ export interface Spec extends TurboModule { +enableViewRecyclingForText?: () => boolean; +enableViewRecyclingForView?: () => boolean; +enableVirtualViewDebugFeatures?: () => boolean; + +enableVirtualViewRenderState?: () => boolean; +enableVirtualViewWindowFocusDetection?: () => boolean; +fixMappingOfEventPrioritiesBetweenFabricAndReact?: () => boolean; +fuseboxEnabledRelease?: () => boolean;