From 910e66e6a8e1ae6105bd0a2070f6738918e77f34 Mon Sep 17 00:00:00 2001 From: Peter Abbondanzo Date: Fri, 4 Dec 2026 10:40:18 -0800 Subject: [PATCH] Add fixVirtualizedListMaintainVisibleContentPosition common feature flag Summary: Adds a default-off `fixVirtualizedListMaintainVisibleContentPosition` common feature flag across JS, C++, Android, and iOS so variable-height `VirtualizedList` scroll-stability improvements can land behind a single kill switch while retaining existing behavior by default. Changelog: [Internal] Differential Revision: D136000343 --- .../featureflags/ReactNativeFeatureFlags.kt | 8 +- .../ReactNativeFeatureFlagsCxxAccessor.kt | 12 ++- .../ReactNativeFeatureFlagsCxxInterop.kt | 4 +- .../ReactNativeFeatureFlagsDefaults.kt | 4 +- .../ReactNativeFeatureFlagsLocalAccessor.kt | 13 ++- .../ReactNativeFeatureFlagsProvider.kt | 4 +- .../JReactNativeFeatureFlagsCxxInterop.cpp | 16 +++- .../JReactNativeFeatureFlagsCxxInterop.h | 5 +- .../featureflags/ReactNativeFeatureFlags.cpp | 6 +- .../featureflags/ReactNativeFeatureFlags.h | 7 +- .../ReactNativeFeatureFlagsAccessor.cpp | 92 +++++++++++-------- .../ReactNativeFeatureFlagsAccessor.h | 6 +- .../ReactNativeFeatureFlagsDefaults.h | 6 +- .../ReactNativeFeatureFlagsDynamicProvider.h | 11 ++- .../ReactNativeFeatureFlagsProvider.h | 3 +- .../NativeReactNativeFeatureFlags.cpp | 7 +- .../NativeReactNativeFeatureFlags.h | 4 +- .../ReactNativeFeatureFlags.config.js | 11 +++ .../featureflags/ReactNativeFeatureFlags.js | 7 +- .../specs/NativeReactNativeFeatureFlags.js | 3 +- 20 files changed, 173 insertions(+), 56 deletions(-) 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 4235f29476b..bbb766b38a8 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<<3a6a61e2cc2bf01a35ab5c3919462ad5>> + * @generated SignedSource<> */ /** @@ -438,6 +438,12 @@ public object ReactNativeFeatureFlags { @JvmStatic public fun fixTextLayoutOnPixelDensityChange(): Boolean = accessor.fixTextLayoutOnPixelDensityChange() + /** + * Enables scroll-position stability improvements for variable-height VirtualizedLists, including spacer-length stabilization, improved native maintainVisibleContentPosition anchoring, and default anchoring. + */ + @JvmStatic + public fun fixVirtualizedListMaintainVisibleContentPosition(): Boolean = accessor.fixVirtualizedListMaintainVisibleContentPosition() + /** * Fix flex basis computation to not apply FitContent constraint in the main axis for non-measure container nodes, preventing unnecessary re-measurement in scroll containers. */ 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 1369551650b..803aa206579 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<> + * @generated SignedSource<> */ /** @@ -88,6 +88,7 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces private var fixProgrammaticScrollMomentumEventsIOSCache: Boolean? = null private var fixTextInlineViewLineHeightCache: Boolean? = null private var fixTextLayoutOnPixelDensityChangeCache: Boolean? = null + private var fixVirtualizedListMaintainVisibleContentPositionCache: Boolean? = null private var fixYogaFlexBasisFitContentInMainAxisCache: Boolean? = null private var fuseboxAssertSingleHostStateCache: Boolean? = null private var fuseboxEnabledReleaseCache: Boolean? = null @@ -737,6 +738,15 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces return cached } + override fun fixVirtualizedListMaintainVisibleContentPosition(): Boolean { + var cached = fixVirtualizedListMaintainVisibleContentPositionCache + if (cached == null) { + cached = ReactNativeFeatureFlagsCxxInterop.fixVirtualizedListMaintainVisibleContentPosition() + fixVirtualizedListMaintainVisibleContentPositionCache = cached + } + return cached + } + override fun fixYogaFlexBasisFitContentInMainAxis(): Boolean { var cached = fixYogaFlexBasisFitContentInMainAxisCache 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 605434477a7..ec0ee10bbbf 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<> + * @generated SignedSource<<1de551d73a93d8ed040a94001f3be38f>> */ /** @@ -164,6 +164,8 @@ public object ReactNativeFeatureFlagsCxxInterop { @DoNotStrip @JvmStatic public external fun fixTextLayoutOnPixelDensityChange(): Boolean + @DoNotStrip @JvmStatic public external fun fixVirtualizedListMaintainVisibleContentPosition(): Boolean + @DoNotStrip @JvmStatic public external fun fixYogaFlexBasisFitContentInMainAxis(): Boolean @DoNotStrip @JvmStatic public external fun fuseboxAssertSingleHostState(): 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 536ffc40b81..5a02d31dc2a 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<<834b0e9533cbc775a1c12b86140d718d>> + * @generated SignedSource<> */ /** @@ -159,6 +159,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi override fun fixTextLayoutOnPixelDensityChange(): Boolean = false + override fun fixVirtualizedListMaintainVisibleContentPosition(): Boolean = false + override fun fixYogaFlexBasisFitContentInMainAxis(): Boolean = false override fun fuseboxAssertSingleHostState(): 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 b03e57fa3d9..a169cc9e347 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<<15c65d4497fd9f36f8902efb2812b3b2>> + * @generated SignedSource<<7c3d27e67b1f0f10589322c38357e654>> */ /** @@ -92,6 +92,7 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc private var fixProgrammaticScrollMomentumEventsIOSCache: Boolean? = null private var fixTextInlineViewLineHeightCache: Boolean? = null private var fixTextLayoutOnPixelDensityChangeCache: Boolean? = null + private var fixVirtualizedListMaintainVisibleContentPositionCache: Boolean? = null private var fixYogaFlexBasisFitContentInMainAxisCache: Boolean? = null private var fuseboxAssertSingleHostStateCache: Boolean? = null private var fuseboxEnabledReleaseCache: Boolean? = null @@ -809,6 +810,16 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc return cached } + override fun fixVirtualizedListMaintainVisibleContentPosition(): Boolean { + var cached = fixVirtualizedListMaintainVisibleContentPositionCache + if (cached == null) { + cached = currentProvider.fixVirtualizedListMaintainVisibleContentPosition() + accessedFeatureFlags.add("fixVirtualizedListMaintainVisibleContentPosition") + fixVirtualizedListMaintainVisibleContentPositionCache = cached + } + return cached + } + override fun fixYogaFlexBasisFitContentInMainAxis(): Boolean { var cached = fixYogaFlexBasisFitContentInMainAxisCache 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 8e45070b5b8..b3ea5d16677 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<<89f683cb28a7d1ef52c86faa96f1107c>> + * @generated SignedSource<<75454445ce65bfa4e0d02f942c73bb0c>> */ /** @@ -159,6 +159,8 @@ public interface ReactNativeFeatureFlagsProvider { @DoNotStrip public fun fixTextLayoutOnPixelDensityChange(): Boolean + @DoNotStrip public fun fixVirtualizedListMaintainVisibleContentPosition(): Boolean + @DoNotStrip public fun fixYogaFlexBasisFitContentInMainAxis(): Boolean @DoNotStrip public fun fuseboxAssertSingleHostState(): 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 05171db7995..20bb01922aa 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<<407c8e5915db07bb6cc2b9ba4449750a>> + * @generated SignedSource<<32abe9d6748826e5326718f6a89048bb>> */ /** @@ -447,6 +447,12 @@ class ReactNativeFeatureFlagsJavaProvider return method(javaProvider_); } + bool fixVirtualizedListMaintainVisibleContentPosition() override { + static const auto method = + getReactNativeFeatureFlagsProviderJavaClass()->getMethod("fixVirtualizedListMaintainVisibleContentPosition"); + return method(javaProvider_); + } + bool fixYogaFlexBasisFitContentInMainAxis() override { static const auto method = getReactNativeFeatureFlagsProviderJavaClass()->getMethod("fixYogaFlexBasisFitContentInMainAxis"); @@ -1007,6 +1013,11 @@ bool JReactNativeFeatureFlagsCxxInterop::fixTextLayoutOnPixelDensityChange( return ReactNativeFeatureFlags::fixTextLayoutOnPixelDensityChange(); } +bool JReactNativeFeatureFlagsCxxInterop::fixVirtualizedListMaintainVisibleContentPosition( + facebook::jni::alias_ref /*unused*/) { + return ReactNativeFeatureFlags::fixVirtualizedListMaintainVisibleContentPosition(); +} + bool JReactNativeFeatureFlagsCxxInterop::fixYogaFlexBasisFitContentInMainAxis( facebook::jni::alias_ref /*unused*/) { return ReactNativeFeatureFlags::fixYogaFlexBasisFitContentInMainAxis(); @@ -1422,6 +1433,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() { makeNativeMethod( "fixTextLayoutOnPixelDensityChange", JReactNativeFeatureFlagsCxxInterop::fixTextLayoutOnPixelDensityChange), + makeNativeMethod( + "fixVirtualizedListMaintainVisibleContentPosition", + JReactNativeFeatureFlagsCxxInterop::fixVirtualizedListMaintainVisibleContentPosition), makeNativeMethod( "fixYogaFlexBasisFitContentInMainAxis", JReactNativeFeatureFlagsCxxInterop::fixYogaFlexBasisFitContentInMainAxis), 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 8a3d8c458db..760b4be06d5 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<<7cb5d49e9124d56b3e242e2023db8649>> + * @generated SignedSource<> */ /** @@ -234,6 +234,9 @@ class JReactNativeFeatureFlagsCxxInterop static bool fixTextLayoutOnPixelDensityChange( facebook::jni::alias_ref); + static bool fixVirtualizedListMaintainVisibleContentPosition( + facebook::jni::alias_ref); + static bool fixYogaFlexBasisFitContentInMainAxis( 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 8b4970ef87f..3bcc87df8e0 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<> + * @generated SignedSource<> */ /** @@ -298,6 +298,10 @@ bool ReactNativeFeatureFlags::fixTextLayoutOnPixelDensityChange() { return getAccessor().fixTextLayoutOnPixelDensityChange(); } +bool ReactNativeFeatureFlags::fixVirtualizedListMaintainVisibleContentPosition() { + return getAccessor().fixVirtualizedListMaintainVisibleContentPosition(); +} + bool ReactNativeFeatureFlags::fixYogaFlexBasisFitContentInMainAxis() { return getAccessor().fixYogaFlexBasisFitContentInMainAxis(); } diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h index dd6d63f7373..54979f41ea6 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<<2ddd9296377ea4c1fd9c84883fbde049>> + * @generated SignedSource<<899da3bc401e78edf7cd397b1e62a61c>> */ /** @@ -381,6 +381,11 @@ class ReactNativeFeatureFlags { */ RN_EXPORT static bool fixTextLayoutOnPixelDensityChange(); + /** + * Enables scroll-position stability improvements for variable-height VirtualizedLists, including spacer-length stabilization, improved native maintainVisibleContentPosition anchoring, and default anchoring. + */ + RN_EXPORT static bool fixVirtualizedListMaintainVisibleContentPosition(); + /** * Fix flex basis computation to not apply FitContent constraint in the main axis for non-measure container nodes, preventing unnecessary re-measurement in scroll containers. */ diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp index 461adbb5f51..7d52cc3ffea 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<> + * @generated SignedSource<<3dc5dfabc263671eeda14e80d92148e8>> */ /** @@ -1253,6 +1253,24 @@ bool ReactNativeFeatureFlagsAccessor::fixTextLayoutOnPixelDensityChange() { return flagValue.value(); } +bool ReactNativeFeatureFlagsAccessor::fixVirtualizedListMaintainVisibleContentPosition() { + auto flagValue = fixVirtualizedListMaintainVisibleContentPosition_.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(68, "fixVirtualizedListMaintainVisibleContentPosition"); + + flagValue = currentProvider_->fixVirtualizedListMaintainVisibleContentPosition(); + fixVirtualizedListMaintainVisibleContentPosition_ = flagValue; + } + + return flagValue.value(); +} + bool ReactNativeFeatureFlagsAccessor::fixYogaFlexBasisFitContentInMainAxis() { auto flagValue = fixYogaFlexBasisFitContentInMainAxis_.load(); @@ -1262,7 +1280,7 @@ bool ReactNativeFeatureFlagsAccessor::fixYogaFlexBasisFitContentInMainAxis() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(68, "fixYogaFlexBasisFitContentInMainAxis"); + markFlagAsAccessed(69, "fixYogaFlexBasisFitContentInMainAxis"); flagValue = currentProvider_->fixYogaFlexBasisFitContentInMainAxis(); fixYogaFlexBasisFitContentInMainAxis_ = flagValue; @@ -1280,7 +1298,7 @@ bool ReactNativeFeatureFlagsAccessor::fuseboxAssertSingleHostState() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(69, "fuseboxAssertSingleHostState"); + markFlagAsAccessed(70, "fuseboxAssertSingleHostState"); flagValue = currentProvider_->fuseboxAssertSingleHostState(); fuseboxAssertSingleHostState_ = flagValue; @@ -1298,7 +1316,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(70, "fuseboxEnabledRelease"); + markFlagAsAccessed(71, "fuseboxEnabledRelease"); flagValue = currentProvider_->fuseboxEnabledRelease(); fuseboxEnabledRelease_ = flagValue; @@ -1316,7 +1334,7 @@ bool ReactNativeFeatureFlagsAccessor::fuseboxFrameRecordingEnabled() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(71, "fuseboxFrameRecordingEnabled"); + markFlagAsAccessed(72, "fuseboxFrameRecordingEnabled"); flagValue = currentProvider_->fuseboxFrameRecordingEnabled(); fuseboxFrameRecordingEnabled_ = flagValue; @@ -1334,7 +1352,7 @@ bool ReactNativeFeatureFlagsAccessor::fuseboxScreenshotCaptureEnabled() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(72, "fuseboxScreenshotCaptureEnabled"); + markFlagAsAccessed(73, "fuseboxScreenshotCaptureEnabled"); flagValue = currentProvider_->fuseboxScreenshotCaptureEnabled(); fuseboxScreenshotCaptureEnabled_ = flagValue; @@ -1352,7 +1370,7 @@ bool ReactNativeFeatureFlagsAccessor::fuseboxWebSocketEventsEnabled() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(73, "fuseboxWebSocketEventsEnabled"); + markFlagAsAccessed(74, "fuseboxWebSocketEventsEnabled"); flagValue = currentProvider_->fuseboxWebSocketEventsEnabled(); fuseboxWebSocketEventsEnabled_ = flagValue; @@ -1370,7 +1388,7 @@ bool ReactNativeFeatureFlagsAccessor::keepTimersRunningWhileHostPausedAndroid() // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(74, "keepTimersRunningWhileHostPausedAndroid"); + markFlagAsAccessed(75, "keepTimersRunningWhileHostPausedAndroid"); flagValue = currentProvider_->keepTimersRunningWhileHostPausedAndroid(); keepTimersRunningWhileHostPausedAndroid_ = flagValue; @@ -1388,7 +1406,7 @@ bool ReactNativeFeatureFlagsAccessor::optimizedAnimatedPropUpdates() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(75, "optimizedAnimatedPropUpdates"); + markFlagAsAccessed(76, "optimizedAnimatedPropUpdates"); flagValue = currentProvider_->optimizedAnimatedPropUpdates(); optimizedAnimatedPropUpdates_ = flagValue; @@ -1406,7 +1424,7 @@ bool ReactNativeFeatureFlagsAccessor::overrideBySynchronousMountPropsAtMountingA // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(76, "overrideBySynchronousMountPropsAtMountingAndroid"); + markFlagAsAccessed(77, "overrideBySynchronousMountPropsAtMountingAndroid"); flagValue = currentProvider_->overrideBySynchronousMountPropsAtMountingAndroid(); overrideBySynchronousMountPropsAtMountingAndroid_ = flagValue; @@ -1424,7 +1442,7 @@ bool ReactNativeFeatureFlagsAccessor::perfIssuesEnabled() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(77, "perfIssuesEnabled"); + markFlagAsAccessed(78, "perfIssuesEnabled"); flagValue = currentProvider_->perfIssuesEnabled(); perfIssuesEnabled_ = flagValue; @@ -1442,7 +1460,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(78, "perfMonitorV2Enabled"); + markFlagAsAccessed(79, "perfMonitorV2Enabled"); flagValue = currentProvider_->perfMonitorV2Enabled(); perfMonitorV2Enabled_ = flagValue; @@ -1460,7 +1478,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(79, "preparedTextCacheSize"); + markFlagAsAccessed(80, "preparedTextCacheSize"); flagValue = currentProvider_->preparedTextCacheSize(); preparedTextCacheSize_ = flagValue; @@ -1478,7 +1496,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(80, "preventShadowTreeCommitExhaustion"); + markFlagAsAccessed(81, "preventShadowTreeCommitExhaustion"); flagValue = currentProvider_->preventShadowTreeCommitExhaustion(); preventShadowTreeCommitExhaustion_ = flagValue; @@ -1496,7 +1514,7 @@ bool ReactNativeFeatureFlagsAccessor::redBoxV2Android() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(81, "redBoxV2Android"); + markFlagAsAccessed(82, "redBoxV2Android"); flagValue = currentProvider_->redBoxV2Android(); redBoxV2Android_ = flagValue; @@ -1514,7 +1532,7 @@ bool ReactNativeFeatureFlagsAccessor::redBoxV2IOS() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(82, "redBoxV2IOS"); + markFlagAsAccessed(83, "redBoxV2IOS"); flagValue = currentProvider_->redBoxV2IOS(); redBoxV2IOS_ = flagValue; @@ -1532,7 +1550,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(83, "shouldPressibilityUseW3CPointerEventsForHover"); + markFlagAsAccessed(84, "shouldPressibilityUseW3CPointerEventsForHover"); flagValue = currentProvider_->shouldPressibilityUseW3CPointerEventsForHover(); shouldPressibilityUseW3CPointerEventsForHover_ = flagValue; @@ -1550,7 +1568,7 @@ bool ReactNativeFeatureFlagsAccessor::shouldTriggerResponderTransferOnScrollAndr // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(84, "shouldTriggerResponderTransferOnScrollAndroid"); + markFlagAsAccessed(85, "shouldTriggerResponderTransferOnScrollAndroid"); flagValue = currentProvider_->shouldTriggerResponderTransferOnScrollAndroid(); shouldTriggerResponderTransferOnScrollAndroid_ = flagValue; @@ -1568,7 +1586,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(85, "skipActivityIdentityAssertionOnHostPause"); + markFlagAsAccessed(86, "skipActivityIdentityAssertionOnHostPause"); flagValue = currentProvider_->skipActivityIdentityAssertionOnHostPause(); skipActivityIdentityAssertionOnHostPause_ = flagValue; @@ -1586,7 +1604,7 @@ bool ReactNativeFeatureFlagsAccessor::skipNativePropsForViewManagerWithDelegateA // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(86, "skipNativePropsForViewManagerWithDelegateAndroid"); + markFlagAsAccessed(87, "skipNativePropsForViewManagerWithDelegateAndroid"); flagValue = currentProvider_->skipNativePropsForViewManagerWithDelegateAndroid(); skipNativePropsForViewManagerWithDelegateAndroid_ = flagValue; @@ -1604,7 +1622,7 @@ bool ReactNativeFeatureFlagsAccessor::skipUnchangedChildrenInDifferentiator() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(87, "skipUnchangedChildrenInDifferentiator"); + markFlagAsAccessed(88, "skipUnchangedChildrenInDifferentiator"); flagValue = currentProvider_->skipUnchangedChildrenInDifferentiator(); skipUnchangedChildrenInDifferentiator_ = flagValue; @@ -1622,7 +1640,7 @@ bool ReactNativeFeatureFlagsAccessor::syncAndroidClipBoundsWithOverflow() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(88, "syncAndroidClipBoundsWithOverflow"); + markFlagAsAccessed(89, "syncAndroidClipBoundsWithOverflow"); flagValue = currentProvider_->syncAndroidClipBoundsWithOverflow(); syncAndroidClipBoundsWithOverflow_ = flagValue; @@ -1640,7 +1658,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(89, "traceTurboModulePromiseRejectionsOnAndroid"); + markFlagAsAccessed(90, "traceTurboModulePromiseRejectionsOnAndroid"); flagValue = currentProvider_->traceTurboModulePromiseRejectionsOnAndroid(); traceTurboModulePromiseRejectionsOnAndroid_ = flagValue; @@ -1658,7 +1676,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(90, "updateRuntimeShadowNodeReferencesOnCommit"); + markFlagAsAccessed(91, "updateRuntimeShadowNodeReferencesOnCommit"); flagValue = currentProvider_->updateRuntimeShadowNodeReferencesOnCommit(); updateRuntimeShadowNodeReferencesOnCommit_ = flagValue; @@ -1676,7 +1694,7 @@ bool ReactNativeFeatureFlagsAccessor::updateRuntimeShadowNodeReferencesOnCommitT // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(91, "updateRuntimeShadowNodeReferencesOnCommitThread"); + markFlagAsAccessed(92, "updateRuntimeShadowNodeReferencesOnCommitThread"); flagValue = currentProvider_->updateRuntimeShadowNodeReferencesOnCommitThread(); updateRuntimeShadowNodeReferencesOnCommitThread_ = flagValue; @@ -1694,7 +1712,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(92, "useAlwaysAvailableJSErrorHandling"); + markFlagAsAccessed(93, "useAlwaysAvailableJSErrorHandling"); flagValue = currentProvider_->useAlwaysAvailableJSErrorHandling(); useAlwaysAvailableJSErrorHandling_ = flagValue; @@ -1712,7 +1730,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(93, "useFabricInterop"); + markFlagAsAccessed(94, "useFabricInterop"); flagValue = currentProvider_->useFabricInterop(); useFabricInterop_ = flagValue; @@ -1730,7 +1748,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(94, "useNativeViewConfigsInBridgelessMode"); + markFlagAsAccessed(95, "useNativeViewConfigsInBridgelessMode"); flagValue = currentProvider_->useNativeViewConfigsInBridgelessMode(); useNativeViewConfigsInBridgelessMode_ = flagValue; @@ -1748,7 +1766,7 @@ bool ReactNativeFeatureFlagsAccessor::useNestedScrollViewAndroid() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(95, "useNestedScrollViewAndroid"); + markFlagAsAccessed(96, "useNestedScrollViewAndroid"); flagValue = currentProvider_->useNestedScrollViewAndroid(); useNestedScrollViewAndroid_ = flagValue; @@ -1766,7 +1784,7 @@ bool ReactNativeFeatureFlagsAccessor::useSharedAnimatedBackend() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(96, "useSharedAnimatedBackend"); + markFlagAsAccessed(97, "useSharedAnimatedBackend"); flagValue = currentProvider_->useSharedAnimatedBackend(); useSharedAnimatedBackend_ = flagValue; @@ -1784,7 +1802,7 @@ bool ReactNativeFeatureFlagsAccessor::useTraitHiddenOnAndroid() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(97, "useTraitHiddenOnAndroid"); + markFlagAsAccessed(98, "useTraitHiddenOnAndroid"); flagValue = currentProvider_->useTraitHiddenOnAndroid(); useTraitHiddenOnAndroid_ = flagValue; @@ -1802,7 +1820,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(98, "useTurboModuleInterop"); + markFlagAsAccessed(99, "useTurboModuleInterop"); flagValue = currentProvider_->useTurboModuleInterop(); useTurboModuleInterop_ = flagValue; @@ -1820,7 +1838,7 @@ bool ReactNativeFeatureFlagsAccessor::useWindowDensityForDisplayMetricsAndroid() // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(99, "useWindowDensityForDisplayMetricsAndroid"); + markFlagAsAccessed(100, "useWindowDensityForDisplayMetricsAndroid"); flagValue = currentProvider_->useWindowDensityForDisplayMetricsAndroid(); useWindowDensityForDisplayMetricsAndroid_ = flagValue; @@ -1838,7 +1856,7 @@ double ReactNativeFeatureFlagsAccessor::viewCullingOutsetRatio() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(100, "viewCullingOutsetRatio"); + markFlagAsAccessed(101, "viewCullingOutsetRatio"); flagValue = currentProvider_->viewCullingOutsetRatio(); viewCullingOutsetRatio_ = flagValue; @@ -1856,7 +1874,7 @@ bool ReactNativeFeatureFlagsAccessor::viewTransitionEnabled() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(101, "viewTransitionEnabled"); + markFlagAsAccessed(102, "viewTransitionEnabled"); flagValue = currentProvider_->viewTransitionEnabled(); viewTransitionEnabled_ = flagValue; @@ -1874,7 +1892,7 @@ bool ReactNativeFeatureFlagsAccessor::viewTransitionUseHardwareBitmapAndroid() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(102, "viewTransitionUseHardwareBitmapAndroid"); + markFlagAsAccessed(103, "viewTransitionUseHardwareBitmapAndroid"); flagValue = currentProvider_->viewTransitionUseHardwareBitmapAndroid(); viewTransitionUseHardwareBitmapAndroid_ = flagValue; @@ -1892,7 +1910,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(103, "virtualViewPrerenderRatio"); + markFlagAsAccessed(104, "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 d4616bebccd..2c42f1f8e58 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<<9f2e67fdc5a5e9e452b59c47ceb68411>> + * @generated SignedSource<<7f865db4c287ee8f77b28fc5c0fe4302>> */ /** @@ -102,6 +102,7 @@ class ReactNativeFeatureFlagsAccessor { bool fixProgrammaticScrollMomentumEventsIOS(); bool fixTextInlineViewLineHeight(); bool fixTextLayoutOnPixelDensityChange(); + bool fixVirtualizedListMaintainVisibleContentPosition(); bool fixYogaFlexBasisFitContentInMainAxis(); bool fuseboxAssertSingleHostState(); bool fuseboxEnabledRelease(); @@ -149,7 +150,7 @@ class ReactNativeFeatureFlagsAccessor { std::unique_ptr currentProvider_; bool wasOverridden_; - std::array, 104> accessedFeatureFlags_; + std::array, 105> accessedFeatureFlags_; std::atomic> commonTestFlag_; std::atomic> cdpInteractionMetricsEnabled_; @@ -219,6 +220,7 @@ class ReactNativeFeatureFlagsAccessor { std::atomic> fixProgrammaticScrollMomentumEventsIOS_; std::atomic> fixTextInlineViewLineHeight_; std::atomic> fixTextLayoutOnPixelDensityChange_; + std::atomic> fixVirtualizedListMaintainVisibleContentPosition_; std::atomic> fixYogaFlexBasisFitContentInMainAxis_; std::atomic> fuseboxAssertSingleHostState_; std::atomic> fuseboxEnabledRelease_; diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h index c67cef573d7..67a405c0d0b 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<<7a81ab39c483265b1e958b1091a60778>> + * @generated SignedSource<> */ /** @@ -301,6 +301,10 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider { return false; } + bool fixVirtualizedListMaintainVisibleContentPosition() override { + return false; + } + bool fixYogaFlexBasisFitContentInMainAxis() override { return false; } diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h index 65d27bd4f55..caa063d2f3a 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<<224a696e6d9f5af0cc450c8742d565e2>> + * @generated SignedSource<> */ /** @@ -659,6 +659,15 @@ class ReactNativeFeatureFlagsDynamicProvider : public ReactNativeFeatureFlagsDef return ReactNativeFeatureFlagsDefaults::fixTextLayoutOnPixelDensityChange(); } + bool fixVirtualizedListMaintainVisibleContentPosition() override { + auto value = values_["fixVirtualizedListMaintainVisibleContentPosition"]; + if (!value.isNull()) { + return value.getBool(); + } + + return ReactNativeFeatureFlagsDefaults::fixVirtualizedListMaintainVisibleContentPosition(); + } + bool fixYogaFlexBasisFitContentInMainAxis() override { auto value = values_["fixYogaFlexBasisFitContentInMainAxis"]; if (!value.isNull()) { diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h index 7a33d63c5c3..2ecb82230e8 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<<8aa886405e9e5978c6572980119d7ea9>> + * @generated SignedSource<<91cb915b7fd6348285eed74bf814796c>> */ /** @@ -95,6 +95,7 @@ class ReactNativeFeatureFlagsProvider { virtual bool fixProgrammaticScrollMomentumEventsIOS() = 0; virtual bool fixTextInlineViewLineHeight() = 0; virtual bool fixTextLayoutOnPixelDensityChange() = 0; + virtual bool fixVirtualizedListMaintainVisibleContentPosition() = 0; virtual bool fixYogaFlexBasisFitContentInMainAxis() = 0; virtual bool fuseboxAssertSingleHostState() = 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 3184a83f67a..8ff21ad2331 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<<1b5afe4df88834163a9e8a39ca24dd15>> + * @generated SignedSource<> */ /** @@ -384,6 +384,11 @@ bool NativeReactNativeFeatureFlags::fixTextLayoutOnPixelDensityChange( return ReactNativeFeatureFlags::fixTextLayoutOnPixelDensityChange(); } +bool NativeReactNativeFeatureFlags::fixVirtualizedListMaintainVisibleContentPosition( + jsi::Runtime& /*runtime*/) { + return ReactNativeFeatureFlags::fixVirtualizedListMaintainVisibleContentPosition(); +} + bool NativeReactNativeFeatureFlags::fixYogaFlexBasisFitContentInMainAxis( jsi::Runtime& /*runtime*/) { return ReactNativeFeatureFlags::fixYogaFlexBasisFitContentInMainAxis(); diff --git a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h index c0d6598a33b..02e1d0cee2d 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<<9829941034a694056c0baf2f2e7e6574>> + * @generated SignedSource<<08a45caf88262a160a55fa1465860315>> */ /** @@ -174,6 +174,8 @@ class NativeReactNativeFeatureFlags bool fixTextLayoutOnPixelDensityChange(jsi::Runtime& runtime); + bool fixVirtualizedListMaintainVisibleContentPosition(jsi::Runtime& runtime); + bool fixYogaFlexBasisFitContentInMainAxis(jsi::Runtime& runtime); bool fuseboxAssertSingleHostState(jsi::Runtime& runtime); diff --git a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js index e030600d90b..011af6fb0ba 100644 --- a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js +++ b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js @@ -783,6 +783,17 @@ const definitions: FeatureFlagDefinitions = { }, ossReleaseStage: 'none', }, + fixVirtualizedListMaintainVisibleContentPosition: { + defaultValue: false, + metadata: { + dateAdded: '2026-12-03', + description: + 'Enables scroll-position stability improvements for variable-height VirtualizedLists, including spacer-length stabilization, improved native maintainVisibleContentPosition anchoring, and default anchoring.', + expectedReleaseValue: true, + purpose: 'experimentation', + }, + ossReleaseStage: 'none', + }, fixYogaFlexBasisFitContentInMainAxis: { defaultValue: false, metadata: { diff --git a/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js b/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js index 60509629c60..ad75eb7e605 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<<581558c9591efde03b925773bbf05e66>> + * @generated SignedSource<> * @flow strict * @noformat */ @@ -117,6 +117,7 @@ export type ReactNativeFeatureFlags = Readonly<{ fixProgrammaticScrollMomentumEventsIOS: Getter, fixTextInlineViewLineHeight: Getter, fixTextLayoutOnPixelDensityChange: Getter, + fixVirtualizedListMaintainVisibleContentPosition: Getter, fixYogaFlexBasisFitContentInMainAxis: Getter, fuseboxAssertSingleHostState: Getter, fuseboxEnabledRelease: Getter, @@ -501,6 +502,10 @@ export const fixTextInlineViewLineHeight: Getter = createNativeFlagGett * Re-measures text and re-sends padding and overflow insets to mounted views when the pixel density changes, so text and padded views do not keep sizes from the old density. */ export const fixTextLayoutOnPixelDensityChange: Getter = createNativeFlagGetter('fixTextLayoutOnPixelDensityChange', false); +/** + * Enables scroll-position stability improvements for variable-height VirtualizedLists, including spacer-length stabilization, improved native maintainVisibleContentPosition anchoring, and default anchoring. + */ +export const fixVirtualizedListMaintainVisibleContentPosition: Getter = createNativeFlagGetter('fixVirtualizedListMaintainVisibleContentPosition', false); /** * Fix flex basis computation to not apply FitContent constraint in the main axis for non-measure container nodes, preventing unnecessary re-measurement in scroll containers. */ diff --git a/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js b/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js index e01580594e2..1f9110dc29a 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<<5fc3f6a14b4e46e34e89fe358e57183b>> + * @generated SignedSource<> * @flow strict * @noformat */ @@ -93,6 +93,7 @@ export interface Spec extends TurboModule { readonly fixProgrammaticScrollMomentumEventsIOS?: () => boolean; readonly fixTextInlineViewLineHeight?: () => boolean; readonly fixTextLayoutOnPixelDensityChange?: () => boolean; + readonly fixVirtualizedListMaintainVisibleContentPosition?: () => boolean; readonly fixYogaFlexBasisFitContentInMainAxis?: () => boolean; readonly fuseboxAssertSingleHostState?: () => boolean; readonly fuseboxEnabledRelease?: () => boolean;