Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/react-native/Libraries/Lists/FlatList.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import type {
ViewToken,
} from '@react-native/virtualized-lists';

import * as ReactNativeFeatureFlags from '../../src/private/featureflags/ReactNativeFeatureFlags';
import {type ScrollResponderType} from '../Components/ScrollView/ScrollView';
import {
VirtualizedList,
Expand Down Expand Up @@ -158,7 +159,11 @@ type OptionalProps<ItemT> = {|

// removeClippedSubviewsOrDefault(this.props.removeClippedSubviews)
function removeClippedSubviewsOrDefault(removeClippedSubviews: ?boolean) {
return removeClippedSubviews ?? Platform.OS === 'android';
if (ReactNativeFeatureFlags.shouldUseRemoveClippedSubviewsAsDefaultOnIOS()) {
return removeClippedSubviews ?? true;
} else {
return removeClippedSubviews ?? Platform.OS === 'android';
}
}

// numColumnsOrDefault(this.props.numColumns)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@
"shouldUseSetNativePropsInFabric": {
"description": "Enables use of setNativeProps in JS driven animations.",
"defaultValue": true
},
"shouldUseRemoveClippedSubviewsAsDefaultOnIOS": {
"description": "removeClippedSubviews prop will be used as the default in FlatList on iOS to match Android",
"defaultValue": false
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<<c43dd1db78ac69ca3c39577d45a04071>>
* @generated SignedSource<<f804aa82b9eb799f281a1d752974cc4a>>
* @flow strict-local
*/

Expand Down Expand Up @@ -33,6 +33,7 @@ export type ReactNativeFeatureFlagsJsOnly = {
enableAccessToHostTreeInFabric: Getter<boolean>,
shouldUseAnimatedObjectForTransform: Getter<boolean>,
shouldUseSetNativePropsInFabric: Getter<boolean>,
shouldUseRemoveClippedSubviewsAsDefaultOnIOS: Getter<boolean>,
};

export type ReactNativeFeatureFlagsJsOnlyOverrides = Partial<ReactNativeFeatureFlagsJsOnly>;
Expand Down Expand Up @@ -82,6 +83,11 @@ export const shouldUseAnimatedObjectForTransform: Getter<boolean> = createJavaSc
*/
export const shouldUseSetNativePropsInFabric: Getter<boolean> = createJavaScriptFlagGetter('shouldUseSetNativePropsInFabric', true);

/**
* removeClippedSubviews prop will be used as the default in FlatList on iOS to match Android
*/
export const shouldUseRemoveClippedSubviewsAsDefaultOnIOS: Getter<boolean> = createJavaScriptFlagGetter('shouldUseRemoveClippedSubviewsAsDefaultOnIOS', false);

/**
* Common flag for testing. Do NOT modify.
*/
Expand Down