add unit test for view culling when parent has transform (#49535)

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

changelog: [internal]

Add a unit test to cover scenario where ScrollView's parent has a transform

Reviewed By: NickGerleman

Differential Revision: D69860855

fbshipit-source-id: 1b64665c5b15ad2e5e068d4c6d56f9694ac7cf03
This commit is contained in:
Samuel Susla
2025-02-20 02:32:50 -08:00
committed by Facebook GitHub Bot
parent c99b71780b
commit 9ece93ea67
@@ -812,3 +812,32 @@ test('culling with transform scale', () => {
'Update {type: "ScrollView", nativeID: (N/A)}',
]);
});
test('culling when ScrollView parent has transform', () => {
const root = Fantom.createRoot({viewportWidth: 100, viewportHeight: 100});
Fantom.runTask(() => {
root.render(
<View style={{transform: [{translateY: 100}]}}>
<ScrollView style={{height: 100, width: 100}}>
<View
nativeID={'child'}
style={{height: 10, width: 10, marginTop: 45}}
/>
</ScrollView>
</View>,
);
});
expect(root.takeMountingManagerLogs()).toEqual([
'Update {type: "RootView", nativeID: (root)}',
'Create {type: "View", nativeID: (N/A)}',
'Create {type: "ScrollView", nativeID: (N/A)}',
'Create {type: "View", nativeID: (N/A)}',
'Create {type: "View", nativeID: "child"}',
'Insert {type: "View", parentNativeID: (N/A), index: 0, nativeID: "child"}',
'Insert {type: "View", parentNativeID: (N/A), index: 0, nativeID: (N/A)}',
'Insert {type: "ScrollView", parentNativeID: (N/A), index: 0, nativeID: (N/A)}',
'Insert {type: "View", parentNativeID: (root), index: 0, nativeID: (N/A)}',
]);
});