Fling: Cleanup enableVirtualViewExperimental Feature Flag (#55065)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55065

Cleans up the `enableVirtualViewExperimental` feature flag, so that only the experimental one is ever used.

This does not delete the original implementation or rename the experimental one. I'll do those separately as follow-ups.

Changelog:
[Internal]

Reviewed By: lunaleaps

Differential Revision: D90193651

fbshipit-source-id: e64a40b8ed49e4420370da300f03a8576a49321d
This commit is contained in:
Tim Yung authored and meta-codesync[bot] committed 2026-01-06 20:37:34 -08:00
1 parent 41efc3b588
commit 758a3db449
5 files changed
+29 -45

No files matched your search

@@ -1011,16 +1011,6 @@ const definitions: FeatureFlagDefinitions = {
},
ossReleaseStage: 'none',
},
enableVirtualViewExperimental: {
defaultValue: false,
metadata: {
dateAdded: '2025-08-29',
description: 'Enables the experimental version of `VirtualView`.',
expectedReleaseValue: true,
purpose: 'experimentation',
},
ossReleaseStage: 'none',
},
fixVirtualizeListCollapseWindowSize: {
defaultValue: false,
metadata: {
@@ -11,13 +11,12 @@
import type {ViewStyleProp} from '../../../../Libraries/StyleSheet/StyleSheet';
import type {NativeSyntheticEvent} from '../../../../Libraries/Types/CoreEventTypes';
import type {HostInstance} from '../../types/HostInstance';
import type {NativeModeChangeEvent} from './VirtualViewNativeComponent';
import type {NativeModeChangeEvent} from './VirtualViewExperimentalNativeComponent';
import StyleSheet from '../../../../Libraries/StyleSheet/StyleSheet';
import * as ReactNativeFeatureFlags from '../../featureflags/ReactNativeFeatureFlags';
import {useVirtualViewLogging} from './logger/VirtualViewLogger';
import VirtualViewExperimentalNativeComponent from './VirtualViewExperimentalNativeComponent';
import VirtualViewClassicNativeComponent from './VirtualViewNativeComponent';
import VirtualViewNativeComponent from './VirtualViewExperimentalNativeComponent';
import nullthrows from 'nullthrows';
import * as React from 'react';
// $FlowFixMe[missing-export]
@@ -51,11 +50,6 @@ export type ModeChangeEvent = Readonly<{
target: HostInstance,
}>;
const VirtualViewNativeComponent: typeof VirtualViewClassicNativeComponent =
ReactNativeFeatureFlags.enableVirtualViewExperimental()
? VirtualViewExperimentalNativeComponent
: VirtualViewClassicNativeComponent;
type VirtualViewComponent = component(
children?: React.Node,
hiddenStyle?: (targetRect: Rect) => ViewStyleProp,
@@ -67,6 +67,12 @@ type VirtualViewExperimentalNativeProps = Readonly<{
*/
initialHidden?: boolean,
/**
* This was needed to get VirtualViewManagerDelegate to set this property.
* TODO: Investigate why spread ViewProps doesn't call setter
*/
removeClippedSubviews?: boolean,
/**
* Render state of children.
*
@@ -79,18 +85,13 @@ type VirtualViewExperimentalNativeProps = Readonly<{
*/
renderState: Int32,
/**
* This was needed to get VirtualViewManagerDelegate to set this property.
* TODO: Investigate why spread ViewProps doesn't call setter
*/
removeClippedSubviews?: boolean,
/**
* See `NativeModeChangeEvent`.
*/
onModeChange?: ?DirectEventHandler<NativeModeChangeEvent>,
}>;
// TODO: Rename to eliminate "Experimental" suffix in the name.
export default codegenNativeComponent<VirtualViewExperimentalNativeProps>(
'VirtualViewExperimental',
{
@@ -11,7 +11,7 @@
import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment';
import type {Rect} from '../VirtualView';
import type {NativeModeChangeEvent} from '../VirtualViewNativeComponent';
import type {NativeModeChangeEvent} from '../VirtualViewExperimentalNativeComponent';
import ensureInstance from '../../../__tests__/utilities/ensureInstance';
import isUnreachable from '../../../__tests__/utilities/isUnreachable';
@@ -43,16 +43,16 @@ describe('mode changes', () => {
expect(_logs.states).toHaveLength(1);
expect(root.getRenderedOutput({props: []}).toJSX()).toEqual(
<rn-virtualView>
<rn-virtualViewExperimental>
<rn-paragraph>Child</rn-paragraph>
</rn-virtualView>,
</rn-virtualViewExperimental>,
);
dispatchModeChangeEvent(viewRef.current, VirtualViewMode.Hidden);
expect(_logs.states).toHaveLength(2);
expect(root.getRenderedOutput({props: []}).toJSX()).toEqual(
<rn-virtualView />,
<rn-virtualViewExperimental />,
);
});
@@ -72,16 +72,16 @@ describe('mode changes', () => {
expect(_logs.states).toHaveLength(2);
expect(root.getRenderedOutput({props: []}).toJSX()).toEqual(
<rn-virtualView />,
<rn-virtualViewExperimental />,
);
dispatchModeChangeEvent(viewRef.current, VirtualViewMode.Visible);
expect(_logs.states).toHaveLength(3);
expect(root.getRenderedOutput({props: []}).toJSX()).toEqual(
<rn-virtualView>
<rn-virtualViewExperimental>
<rn-paragraph>Child</rn-paragraph>
</rn-virtualView>,
</rn-virtualViewExperimental>,
);
});
@@ -101,9 +101,9 @@ describe('mode changes', () => {
expect(_logs.states).toHaveLength(1);
expect(root.getRenderedOutput({props: []}).toJSX()).toEqual(
<rn-virtualView>
<rn-virtualViewExperimental>
<rn-paragraph>Child</rn-paragraph>
</rn-virtualView>,
</rn-virtualViewExperimental>,
);
dispatchModeChangeEvent(viewRef.current, VirtualViewMode.Visible);
@@ -111,9 +111,9 @@ describe('mode changes', () => {
// Expects `VirtualView` does not undergo a state update.
expect(_logs.states).toHaveLength(1);
expect(root.getRenderedOutput({props: []}).toJSX()).toEqual(
<rn-virtualView>
<rn-virtualViewExperimental>
<rn-paragraph>Child</rn-paragraph>
</rn-virtualView>,
</rn-virtualViewExperimental>,
);
});
});
@@ -128,7 +128,7 @@ describe('styles', () => {
expect(
root.getRenderedOutput({props: ['minHeight', 'minWidth']}).toJSX(),
).toEqual(<rn-virtualView />);
).toEqual(<rn-virtualViewExperimental />);
});
test('does not set styles when prerendered', () => {
@@ -143,7 +143,7 @@ describe('styles', () => {
expect(
root.getRenderedOutput({props: ['minHeight', 'minWidth']}).toJSX(),
).toEqual(<rn-virtualView />);
).toEqual(<rn-virtualViewExperimental />);
});
test('sets styles when hidden', () => {
@@ -158,7 +158,12 @@ describe('styles', () => {
expect(
root.getRenderedOutput({props: ['minHeight', 'minWidth']}).toJSX(),
).toEqual(<rn-virtualView minHeight="100.000000" minWidth="100.000000" />);
).toEqual(
<rn-virtualViewExperimental
minHeight="100.000000"
minWidth="100.000000"
/>,
);
});
});
@@ -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<<bf6ca0830458dd53c3d8edf227c1c4d9>>
* @generated SignedSource<<b0e0bebf50d1a5b3d1c53447074786fd>>
* @flow strict
* @noformat
*/
@@ -33,7 +33,6 @@ export type ReactNativeFeatureFlagsJsOnly = $ReadOnly<{
animatedShouldUseSingleOp: Getter<boolean>,
deferFlatListFocusChangeRenderUpdate: Getter<boolean>,
disableMaintainVisibleContentPosition: Getter<boolean>,
enableVirtualViewExperimental: Getter<boolean>,
fixVirtualizeListCollapseWindowSize: Getter<boolean>,
isLayoutAnimationEnabled: Getter<boolean>,
reduceDefaultPropsInImage: Getter<boolean>,
@@ -163,11 +162,6 @@ export const deferFlatListFocusChangeRenderUpdate: Getter<boolean> = createJavaS
*/
export const disableMaintainVisibleContentPosition: Getter<boolean> = createJavaScriptFlagGetter('disableMaintainVisibleContentPosition', false);
/**
* Enables the experimental version of `VirtualView`.
*/
export const enableVirtualViewExperimental: Getter<boolean> = createJavaScriptFlagGetter('enableVirtualViewExperimental', false);
/**
* Fixing an edge case where the current window size is not properly calculated with fast scrolling. Window size collapsed to 1 element even if windowSize more than the current amount of elements
*/