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 47a89ef25e6..2e8ddc6b297 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<> + * @generated SignedSource<<92a6edded037a504fc1c2c8ae88deae1>> */ /** @@ -258,6 +258,12 @@ public object ReactNativeFeatureFlags { @JvmStatic public fun enableViewRecycling(): Boolean = accessor.enableViewRecycling() + /** + * Enables View Recycling for via ReactViewGroup/ReactViewManager. + */ + @JvmStatic + public fun enableViewRecyclingForImage(): Boolean = accessor.enableViewRecyclingForImage() + /** * Enables View Recycling for via ReactViewGroup/ReactViewManager. */ 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 0e74d436129..0b66c832b80 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<<37203dffb9421d1036aaeaeaa7319e28>> + * @generated SignedSource<> */ /** @@ -58,6 +58,7 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces private var enableResourceTimingAPICache: Boolean? = null private var enableViewCullingCache: Boolean? = null private var enableViewRecyclingCache: Boolean? = null + private var enableViewRecyclingForImageCache: Boolean? = null private var enableViewRecyclingForScrollViewCache: Boolean? = null private var enableViewRecyclingForTextCache: Boolean? = null private var enableViewRecyclingForViewCache: Boolean? = null @@ -431,6 +432,15 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces return cached } + override fun enableViewRecyclingForImage(): Boolean { + var cached = enableViewRecyclingForImageCache + if (cached == null) { + cached = ReactNativeFeatureFlagsCxxInterop.enableViewRecyclingForImage() + enableViewRecyclingForImageCache = cached + } + return cached + } + override fun enableViewRecyclingForScrollView(): Boolean { var cached = enableViewRecyclingForScrollViewCache 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 1702ddfcd05..615bdf546b4 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<<9c0acc876e3205fe2ea181e71eb512c9>> + * @generated SignedSource<<4410628511f112f3eef22434a05fa757>> */ /** @@ -104,6 +104,8 @@ public object ReactNativeFeatureFlagsCxxInterop { @DoNotStrip @JvmStatic public external fun enableViewRecycling(): Boolean + @DoNotStrip @JvmStatic public external fun enableViewRecyclingForImage(): Boolean + @DoNotStrip @JvmStatic public external fun enableViewRecyclingForScrollView(): Boolean @DoNotStrip @JvmStatic public external fun enableViewRecyclingForText(): 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 73b1b91314d..54e65b67538 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<<05bfed9fc7131062c8b16246986fc999>> + * @generated SignedSource<<411732d441bacbef37c3474b9041202c>> */ /** @@ -99,6 +99,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi override fun enableViewRecycling(): Boolean = false + override fun enableViewRecyclingForImage(): Boolean = true + override fun enableViewRecyclingForScrollView(): Boolean = false override fun enableViewRecyclingForText(): Boolean = true 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 e6b98e04e65..d9235b1552a 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<<9a18369464f81c3d03f2702716dfdb29>> + * @generated SignedSource<<2f65e0e9066a8c2c35c44ea7c73dbedc>> */ /** @@ -62,6 +62,7 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc private var enableResourceTimingAPICache: Boolean? = null private var enableViewCullingCache: Boolean? = null private var enableViewRecyclingCache: Boolean? = null + private var enableViewRecyclingForImageCache: Boolean? = null private var enableViewRecyclingForScrollViewCache: Boolean? = null private var enableViewRecyclingForTextCache: Boolean? = null private var enableViewRecyclingForViewCache: Boolean? = null @@ -473,6 +474,16 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc return cached } + override fun enableViewRecyclingForImage(): Boolean { + var cached = enableViewRecyclingForImageCache + if (cached == null) { + cached = currentProvider.enableViewRecyclingForImage() + accessedFeatureFlags.add("enableViewRecyclingForImage") + enableViewRecyclingForImageCache = cached + } + return cached + } + override fun enableViewRecyclingForScrollView(): Boolean { var cached = enableViewRecyclingForScrollViewCache 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 56e83f45065..7f661006d78 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<<845b2ee5edc9aedbdbd052d9a930f666>> + * @generated SignedSource<> */ /** @@ -99,6 +99,8 @@ public interface ReactNativeFeatureFlagsProvider { @DoNotStrip public fun enableViewRecycling(): Boolean + @DoNotStrip public fun enableViewRecyclingForImage(): Boolean + @DoNotStrip public fun enableViewRecyclingForScrollView(): Boolean @DoNotStrip public fun enableViewRecyclingForText(): Boolean 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 7136900e64f..fd322ea6e13 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<> + * @generated SignedSource<> */ /** @@ -267,6 +267,12 @@ class ReactNativeFeatureFlagsJavaProvider return method(javaProvider_); } + bool enableViewRecyclingForImage() override { + static const auto method = + getReactNativeFeatureFlagsProviderJavaClass()->getMethod("enableViewRecyclingForImage"); + return method(javaProvider_); + } + bool enableViewRecyclingForScrollView() override { static const auto method = getReactNativeFeatureFlagsProviderJavaClass()->getMethod("enableViewRecyclingForScrollView"); @@ -641,6 +647,11 @@ bool JReactNativeFeatureFlagsCxxInterop::enableViewRecycling( return ReactNativeFeatureFlags::enableViewRecycling(); } +bool JReactNativeFeatureFlagsCxxInterop::enableViewRecyclingForImage( + facebook::jni::alias_ref /*unused*/) { + return ReactNativeFeatureFlags::enableViewRecyclingForImage(); +} + bool JReactNativeFeatureFlagsCxxInterop::enableViewRecyclingForScrollView( facebook::jni::alias_ref /*unused*/) { return ReactNativeFeatureFlags::enableViewRecyclingForScrollView(); @@ -936,6 +947,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() { makeNativeMethod( "enableViewRecycling", JReactNativeFeatureFlagsCxxInterop::enableViewRecycling), + makeNativeMethod( + "enableViewRecyclingForImage", + JReactNativeFeatureFlagsCxxInterop::enableViewRecyclingForImage), makeNativeMethod( "enableViewRecyclingForScrollView", JReactNativeFeatureFlagsCxxInterop::enableViewRecyclingForScrollView), 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 559bf56b3e3..ace59ba3937 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<<31298767c1dd669d2a755e67edacc911>> + * @generated SignedSource<<6a98f8398948f8d56e51d3eff19c5d05>> */ /** @@ -144,6 +144,9 @@ class JReactNativeFeatureFlagsCxxInterop static bool enableViewRecycling( facebook::jni::alias_ref); + static bool enableViewRecyclingForImage( + facebook::jni::alias_ref); + static bool enableViewRecyclingForScrollView( 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 b6eed59ab63..83c4a3c4136 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<<9a538d3ebb58173e7e4e34453b71454b>> + * @generated SignedSource<<5bd932f1d52596dad6ea86a2674170ff>> */ /** @@ -178,6 +178,10 @@ bool ReactNativeFeatureFlags::enableViewRecycling() { return getAccessor().enableViewRecycling(); } +bool ReactNativeFeatureFlags::enableViewRecyclingForImage() { + return getAccessor().enableViewRecyclingForImage(); +} + bool ReactNativeFeatureFlags::enableViewRecyclingForScrollView() { return getAccessor().enableViewRecyclingForScrollView(); } diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h index be6ac38c3d6..f6a20cb6d7e 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<<3321d357fe5c74fa42c2d0b15a744f87>> + * @generated SignedSource<<3cde1e9bcf234515551ba57ecf02e3a7>> */ /** @@ -229,6 +229,11 @@ class ReactNativeFeatureFlags { */ RN_EXPORT static bool enableViewRecycling(); + /** + * Enables View Recycling for via ReactViewGroup/ReactViewManager. + */ + RN_EXPORT static bool enableViewRecyclingForImage(); + /** * Enables View Recycling for via ReactViewGroup/ReactViewManager. */ diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp index 120375bd4e4..291aee40401 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<<041526548ef83b4afb12229a0345e29e>> + * @generated SignedSource<> */ /** @@ -713,6 +713,24 @@ bool ReactNativeFeatureFlagsAccessor::enableViewRecycling() { return flagValue.value(); } +bool ReactNativeFeatureFlagsAccessor::enableViewRecyclingForImage() { + auto flagValue = enableViewRecyclingForImage_.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, "enableViewRecyclingForImage"); + + flagValue = currentProvider_->enableViewRecyclingForImage(); + enableViewRecyclingForImage_ = flagValue; + } + + return flagValue.value(); +} + bool ReactNativeFeatureFlagsAccessor::enableViewRecyclingForScrollView() { auto flagValue = enableViewRecyclingForScrollView_.load(); @@ -722,7 +740,7 @@ bool ReactNativeFeatureFlagsAccessor::enableViewRecyclingForScrollView() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(38, "enableViewRecyclingForScrollView"); + markFlagAsAccessed(39, "enableViewRecyclingForScrollView"); flagValue = currentProvider_->enableViewRecyclingForScrollView(); enableViewRecyclingForScrollView_ = flagValue; @@ -740,7 +758,7 @@ bool ReactNativeFeatureFlagsAccessor::enableViewRecyclingForText() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(39, "enableViewRecyclingForText"); + markFlagAsAccessed(40, "enableViewRecyclingForText"); flagValue = currentProvider_->enableViewRecyclingForText(); enableViewRecyclingForText_ = flagValue; @@ -758,7 +776,7 @@ bool ReactNativeFeatureFlagsAccessor::enableViewRecyclingForView() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(40, "enableViewRecyclingForView"); + markFlagAsAccessed(41, "enableViewRecyclingForView"); flagValue = currentProvider_->enableViewRecyclingForView(); enableViewRecyclingForView_ = flagValue; @@ -776,7 +794,7 @@ bool ReactNativeFeatureFlagsAccessor::enableVirtualViewDebugFeatures() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(41, "enableVirtualViewDebugFeatures"); + markFlagAsAccessed(42, "enableVirtualViewDebugFeatures"); flagValue = currentProvider_->enableVirtualViewDebugFeatures(); enableVirtualViewDebugFeatures_ = flagValue; @@ -794,7 +812,7 @@ bool ReactNativeFeatureFlagsAccessor::enableVirtualViewRenderState() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(42, "enableVirtualViewRenderState"); + markFlagAsAccessed(43, "enableVirtualViewRenderState"); flagValue = currentProvider_->enableVirtualViewRenderState(); enableVirtualViewRenderState_ = flagValue; @@ -812,7 +830,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(43, "enableVirtualViewWindowFocusDetection"); + markFlagAsAccessed(44, "enableVirtualViewWindowFocusDetection"); flagValue = currentProvider_->enableVirtualViewWindowFocusDetection(); enableVirtualViewWindowFocusDetection_ = flagValue; @@ -830,7 +848,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(44, "fixMappingOfEventPrioritiesBetweenFabricAndReact"); + markFlagAsAccessed(45, "fixMappingOfEventPrioritiesBetweenFabricAndReact"); flagValue = currentProvider_->fixMappingOfEventPrioritiesBetweenFabricAndReact(); fixMappingOfEventPrioritiesBetweenFabricAndReact_ = flagValue; @@ -848,7 +866,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(45, "fuseboxEnabledRelease"); + markFlagAsAccessed(46, "fuseboxEnabledRelease"); flagValue = currentProvider_->fuseboxEnabledRelease(); fuseboxEnabledRelease_ = flagValue; @@ -866,7 +884,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(46, "fuseboxNetworkInspectionEnabled"); + markFlagAsAccessed(47, "fuseboxNetworkInspectionEnabled"); flagValue = currentProvider_->fuseboxNetworkInspectionEnabled(); fuseboxNetworkInspectionEnabled_ = flagValue; @@ -884,7 +902,7 @@ bool ReactNativeFeatureFlagsAccessor::hideOffscreenVirtualViewsOnIOS() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(47, "hideOffscreenVirtualViewsOnIOS"); + markFlagAsAccessed(48, "hideOffscreenVirtualViewsOnIOS"); flagValue = currentProvider_->hideOffscreenVirtualViewsOnIOS(); hideOffscreenVirtualViewsOnIOS_ = flagValue; @@ -902,7 +920,7 @@ bool ReactNativeFeatureFlagsAccessor::perfMonitorV2Enabled() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(48, "perfMonitorV2Enabled"); + markFlagAsAccessed(49, "perfMonitorV2Enabled"); flagValue = currentProvider_->perfMonitorV2Enabled(); perfMonitorV2Enabled_ = flagValue; @@ -920,7 +938,7 @@ double ReactNativeFeatureFlagsAccessor::preparedTextCacheSize() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(49, "preparedTextCacheSize"); + markFlagAsAccessed(50, "preparedTextCacheSize"); flagValue = currentProvider_->preparedTextCacheSize(); preparedTextCacheSize_ = flagValue; @@ -938,7 +956,7 @@ bool ReactNativeFeatureFlagsAccessor::preventShadowTreeCommitExhaustion() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(50, "preventShadowTreeCommitExhaustion"); + markFlagAsAccessed(51, "preventShadowTreeCommitExhaustion"); flagValue = currentProvider_->preventShadowTreeCommitExhaustion(); preventShadowTreeCommitExhaustion_ = flagValue; @@ -956,7 +974,7 @@ bool ReactNativeFeatureFlagsAccessor::shouldPressibilityUseW3CPointerEventsForHo // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(51, "shouldPressibilityUseW3CPointerEventsForHover"); + markFlagAsAccessed(52, "shouldPressibilityUseW3CPointerEventsForHover"); flagValue = currentProvider_->shouldPressibilityUseW3CPointerEventsForHover(); shouldPressibilityUseW3CPointerEventsForHover_ = flagValue; @@ -974,7 +992,7 @@ bool ReactNativeFeatureFlagsAccessor::skipActivityIdentityAssertionOnHostPause() // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(52, "skipActivityIdentityAssertionOnHostPause"); + markFlagAsAccessed(53, "skipActivityIdentityAssertionOnHostPause"); flagValue = currentProvider_->skipActivityIdentityAssertionOnHostPause(); skipActivityIdentityAssertionOnHostPause_ = flagValue; @@ -992,7 +1010,7 @@ bool ReactNativeFeatureFlagsAccessor::sweepActiveTouchOnChildNativeGesturesAndro // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(53, "sweepActiveTouchOnChildNativeGesturesAndroid"); + markFlagAsAccessed(54, "sweepActiveTouchOnChildNativeGesturesAndroid"); flagValue = currentProvider_->sweepActiveTouchOnChildNativeGesturesAndroid(); sweepActiveTouchOnChildNativeGesturesAndroid_ = flagValue; @@ -1010,7 +1028,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(54, "traceTurboModulePromiseRejectionsOnAndroid"); + markFlagAsAccessed(55, "traceTurboModulePromiseRejectionsOnAndroid"); flagValue = currentProvider_->traceTurboModulePromiseRejectionsOnAndroid(); traceTurboModulePromiseRejectionsOnAndroid_ = flagValue; @@ -1028,7 +1046,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(55, "updateRuntimeShadowNodeReferencesOnCommit"); + markFlagAsAccessed(56, "updateRuntimeShadowNodeReferencesOnCommit"); flagValue = currentProvider_->updateRuntimeShadowNodeReferencesOnCommit(); updateRuntimeShadowNodeReferencesOnCommit_ = flagValue; @@ -1046,7 +1064,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(56, "useAlwaysAvailableJSErrorHandling"); + markFlagAsAccessed(57, "useAlwaysAvailableJSErrorHandling"); flagValue = currentProvider_->useAlwaysAvailableJSErrorHandling(); useAlwaysAvailableJSErrorHandling_ = flagValue; @@ -1064,7 +1082,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(57, "useFabricInterop"); + markFlagAsAccessed(58, "useFabricInterop"); flagValue = currentProvider_->useFabricInterop(); useFabricInterop_ = flagValue; @@ -1082,7 +1100,7 @@ bool ReactNativeFeatureFlagsAccessor::useNativeEqualsInNativeReadableArrayAndroi // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(58, "useNativeEqualsInNativeReadableArrayAndroid"); + markFlagAsAccessed(59, "useNativeEqualsInNativeReadableArrayAndroid"); flagValue = currentProvider_->useNativeEqualsInNativeReadableArrayAndroid(); useNativeEqualsInNativeReadableArrayAndroid_ = flagValue; @@ -1100,7 +1118,7 @@ bool ReactNativeFeatureFlagsAccessor::useNativeTransformHelperAndroid() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(59, "useNativeTransformHelperAndroid"); + markFlagAsAccessed(60, "useNativeTransformHelperAndroid"); flagValue = currentProvider_->useNativeTransformHelperAndroid(); useNativeTransformHelperAndroid_ = flagValue; @@ -1118,7 +1136,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(60, "useNativeViewConfigsInBridgelessMode"); + markFlagAsAccessed(61, "useNativeViewConfigsInBridgelessMode"); flagValue = currentProvider_->useNativeViewConfigsInBridgelessMode(); useNativeViewConfigsInBridgelessMode_ = flagValue; @@ -1136,7 +1154,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(61, "useOptimizedEventBatchingOnAndroid"); + markFlagAsAccessed(62, "useOptimizedEventBatchingOnAndroid"); flagValue = currentProvider_->useOptimizedEventBatchingOnAndroid(); useOptimizedEventBatchingOnAndroid_ = flagValue; @@ -1154,7 +1172,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(62, "useRawPropsJsiValue"); + markFlagAsAccessed(63, "useRawPropsJsiValue"); flagValue = currentProvider_->useRawPropsJsiValue(); useRawPropsJsiValue_ = flagValue; @@ -1172,7 +1190,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(63, "useShadowNodeStateOnClone"); + markFlagAsAccessed(64, "useShadowNodeStateOnClone"); flagValue = currentProvider_->useShadowNodeStateOnClone(); useShadowNodeStateOnClone_ = flagValue; @@ -1190,7 +1208,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(64, "useTurboModuleInterop"); + markFlagAsAccessed(65, "useTurboModuleInterop"); flagValue = currentProvider_->useTurboModuleInterop(); useTurboModuleInterop_ = flagValue; @@ -1208,7 +1226,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(65, "useTurboModules"); + markFlagAsAccessed(66, "useTurboModules"); flagValue = currentProvider_->useTurboModules(); useTurboModules_ = flagValue; @@ -1226,7 +1244,7 @@ double ReactNativeFeatureFlagsAccessor::virtualViewHysteresisRatio() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(66, "virtualViewHysteresisRatio"); + markFlagAsAccessed(67, "virtualViewHysteresisRatio"); flagValue = currentProvider_->virtualViewHysteresisRatio(); virtualViewHysteresisRatio_ = flagValue; @@ -1244,7 +1262,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(67, "virtualViewPrerenderRatio"); + markFlagAsAccessed(68, "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 8e8d3c294e4..a580922d1ec 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<<9c51131fae9f19d03050be0c74ca3d4b>> + * @generated SignedSource<> */ /** @@ -70,6 +70,7 @@ class ReactNativeFeatureFlagsAccessor { bool enableResourceTimingAPI(); bool enableViewCulling(); bool enableViewRecycling(); + bool enableViewRecyclingForImage(); bool enableViewRecyclingForScrollView(); bool enableViewRecyclingForText(); bool enableViewRecyclingForView(); @@ -111,7 +112,7 @@ class ReactNativeFeatureFlagsAccessor { std::unique_ptr currentProvider_; bool wasOverridden_; - std::array, 68> accessedFeatureFlags_; + std::array, 69> accessedFeatureFlags_; std::atomic> commonTestFlag_; std::atomic> cdpInteractionMetricsEnabled_; @@ -151,6 +152,7 @@ class ReactNativeFeatureFlagsAccessor { std::atomic> enableResourceTimingAPI_; std::atomic> enableViewCulling_; std::atomic> enableViewRecycling_; + std::atomic> enableViewRecyclingForImage_; std::atomic> enableViewRecyclingForScrollView_; std::atomic> enableViewRecyclingForText_; std::atomic> enableViewRecyclingForView_; diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h index 0c29a6ef23c..2969a1fc971 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<<5f9c3ecf7887653fd5348a05391ab7d0>> + * @generated SignedSource<<6d8adaa4b960407540afb1d6e42a3840>> */ /** @@ -179,6 +179,10 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider { return false; } + bool enableViewRecyclingForImage() override { + return true; + } + bool enableViewRecyclingForScrollView() override { return false; } diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h index 1a373688ac0..18c52e44c7e 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<<027cef9dd44f14a71be7c0d1b90238b3>> + * @generated SignedSource<> */ /** @@ -387,6 +387,15 @@ class ReactNativeFeatureFlagsDynamicProvider : public ReactNativeFeatureFlagsDef return ReactNativeFeatureFlagsDefaults::enableViewRecycling(); } + bool enableViewRecyclingForImage() override { + auto value = values_["enableViewRecyclingForImage"]; + if (!value.isNull()) { + return value.getBool(); + } + + return ReactNativeFeatureFlagsDefaults::enableViewRecyclingForImage(); + } + bool enableViewRecyclingForScrollView() override { auto value = values_["enableViewRecyclingForScrollView"]; if (!value.isNull()) { diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h index 837e85c6fd3..6eb9a1e93b2 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<<07b25b19a265e8afe53eeeffade4dfc0>> */ /** @@ -63,6 +63,7 @@ class ReactNativeFeatureFlagsProvider { virtual bool enableResourceTimingAPI() = 0; virtual bool enableViewCulling() = 0; virtual bool enableViewRecycling() = 0; + virtual bool enableViewRecyclingForImage() = 0; virtual bool enableViewRecyclingForScrollView() = 0; virtual bool enableViewRecyclingForText() = 0; virtual bool enableViewRecyclingForView() = 0; diff --git a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp index 624afc05f7f..bd63a24e748 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<<07df05bf452f78603bbf79594aa0cba0>> + * @generated SignedSource<<348005db0ceee698cd7c33f29bcf85a6>> */ /** @@ -234,6 +234,11 @@ bool NativeReactNativeFeatureFlags::enableViewRecycling( return ReactNativeFeatureFlags::enableViewRecycling(); } +bool NativeReactNativeFeatureFlags::enableViewRecyclingForImage( + jsi::Runtime& /*runtime*/) { + return ReactNativeFeatureFlags::enableViewRecyclingForImage(); +} + bool NativeReactNativeFeatureFlags::enableViewRecyclingForScrollView( jsi::Runtime& /*runtime*/) { return ReactNativeFeatureFlags::enableViewRecyclingForScrollView(); diff --git a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h index 4b1d9860ee4..b3f455bde8b 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<<228d7484ef89bb01fee8dcff2657c56a>> + * @generated SignedSource<> */ /** @@ -112,6 +112,8 @@ class NativeReactNativeFeatureFlags bool enableViewRecycling(jsi::Runtime& runtime); + bool enableViewRecyclingForImage(jsi::Runtime& runtime); + bool enableViewRecyclingForScrollView(jsi::Runtime& runtime); bool enableViewRecyclingForText(jsi::Runtime& runtime); diff --git a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js index d2116260b4f..7ec2687d929 100644 --- a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js +++ b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js @@ -451,6 +451,17 @@ const definitions: FeatureFlagDefinitions = { }, ossReleaseStage: 'none', }, + enableViewRecyclingForImage: { + defaultValue: true, + metadata: { + dateAdded: '2025-09-04', + description: + 'Enables View Recycling for via ReactViewGroup/ReactViewManager.', + expectedReleaseValue: true, + purpose: 'experimentation', + }, + ossReleaseStage: 'none', + }, enableViewRecyclingForScrollView: { defaultValue: false, metadata: { diff --git a/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js b/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js index 08f2f5faaeb..3ff0dd58d6f 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<<7de65fc90fa1275f89375fd214b94172>> + * @generated SignedSource<<2bef8486b596a7593bbc931da63b2682>> * @flow strict * @noformat */ @@ -88,6 +88,7 @@ export type ReactNativeFeatureFlags = $ReadOnly<{ enableResourceTimingAPI: Getter, enableViewCulling: Getter, enableViewRecycling: Getter, + enableViewRecyclingForImage: Getter, enableViewRecyclingForScrollView: Getter, enableViewRecyclingForText: Getter, enableViewRecyclingForView: Getter, @@ -351,6 +352,10 @@ export const enableViewCulling: Getter = createNativeFlagGetter('enable * Enables View Recycling. When enabled, individual ViewManagers must still opt-in. */ export const enableViewRecycling: Getter = createNativeFlagGetter('enableViewRecycling', false); +/** + * Enables View Recycling for via ReactViewGroup/ReactViewManager. + */ +export const enableViewRecyclingForImage: Getter = createNativeFlagGetter('enableViewRecyclingForImage', true); /** * Enables View Recycling for via ReactViewGroup/ReactViewManager. */ diff --git a/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js b/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js index ef29da89413..b874e9013d3 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<<1e6f17de0ebb06a085d4cc563df1e32b>> + * @generated SignedSource<<1c61b3b4390b75dab658518201379081>> * @flow strict * @noformat */ @@ -63,6 +63,7 @@ export interface Spec extends TurboModule { +enableResourceTimingAPI?: () => boolean; +enableViewCulling?: () => boolean; +enableViewRecycling?: () => boolean; + +enableViewRecyclingForImage?: () => boolean; +enableViewRecyclingForScrollView?: () => boolean; +enableViewRecyclingForText?: () => boolean; +enableViewRecyclingForView?: () => boolean;