freshyo/apps/admin-ui/src/lib/list-virtualization.ts
2026-11-01 20:01:14 +05:30

22 lines
920 B
TypeScript

/**
* Shared FlatList windowing for the admin app.
*
* React Native's default windowSize (21) keeps roughly ten viewports of
* off-screen rows mounted. Admin lists are dense and can grow long, so three
* viewports is plenty and cuts the mounted (and re-rendered) row count sharply.
*
* initialNumToRender deliberately stays at RN's default (10): those cells are
* pinned for the scroll-to-top optimisation, and keeping the default means the
* first screen (and the test fixtures) render exactly as before. The win comes
* from windowSize and the smaller render batches.
*
* removeClippedSubviews is false on purpose: several lists contain modals,
* shadows or drag-and-drop cells that expect attached native views.
*/
export const ADMIN_LIST_VIRTUALIZATION = {
initialNumToRender: 10,
maxToRenderPerBatch: 6,
windowSize: 3,
updateCellsBatchingPeriod: 50,
removeClippedSubviews: false,
} as const