Skip to content

Commit 8f0713f

Browse files
Nick Lefeverfacebook-github-bot
authored andcommitted
Add test for empty layout culling skip (#53551)
Summary: Pull Request resolved: #53551 See title. Follow up on D81044841 Changelog: [Internal] Reviewed By: rshest Differential Revision: D81447133 fbshipit-source-id: 7e6ca4523401c30c4861606c795f306193d97a15
1 parent 6e47c95 commit 8f0713f

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

packages/react-native/Libraries/Components/ScrollView/__tests__/ScrollView-viewCulling-itest.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2607,3 +2607,35 @@ describe('horizontal ScrollView in RTL script', () => {
26072607
]);
26082608
});
26092609
});
2610+
2611+
describe('Views with no layout', () => {
2612+
it('are not culled', () => {
2613+
const root = Fantom.createRoot({viewportWidth: 100, viewportHeight: 100});
2614+
2615+
Fantom.runTask(() => {
2616+
root.render(
2617+
<ScrollView style={{height: 100, width: 100}}>
2618+
<View nativeID={'viewWithLayout'} style={{height: 100, width: 100}} />
2619+
<View style={{height: 1000, width: 100}} />
2620+
<View
2621+
nativeID={'culledViewWithLayout'}
2622+
style={{height: 100, width: 100}}
2623+
/>
2624+
<View nativeID={'viewWithoutLayout'} style={{height: 0, width: 0}} />
2625+
</ScrollView>,
2626+
);
2627+
});
2628+
2629+
expect(root.takeMountingManagerLogs()).toEqual([
2630+
'Update {type: "RootView", nativeID: (root)}',
2631+
'Create {type: "ScrollView", nativeID: (N/A)}',
2632+
'Create {type: "View", nativeID: (N/A)}',
2633+
'Create {type: "View", nativeID: "viewWithLayout"}',
2634+
'Create {type: "View", nativeID: "viewWithoutLayout"}',
2635+
'Insert {type: "View", parentNativeID: (N/A), index: 0, nativeID: "viewWithLayout"}',
2636+
'Insert {type: "View", parentNativeID: (N/A), index: 1, nativeID: "viewWithoutLayout"}',
2637+
'Insert {type: "View", parentNativeID: (N/A), index: 0, nativeID: (N/A)}',
2638+
'Insert {type: "ScrollView", parentNativeID: (root), index: 0, nativeID: (N/A)}',
2639+
]);
2640+
});
2641+
});

0 commit comments

Comments
 (0)