Lists: thousands of rows without jank · core
How FlatList virtualization works
FlatList (built on VirtualizedList) renders only the rows inside a window around the screen, measured in screen heights, and replaces far-away rows with empty space, so keys, row cost and window settings decide whether a long list stays smooth.
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceThe notes
What you must know
- FlatList, SectionList and VirtualizedList keep a render window. windowSize defaults to 21: 10 screens above, the visible screen, and 10 screens below.
- Rows outside the window are unmounted and replaced by spacer views. Their local state is lost.
- New rows are rendered in batches on the JS thread (maxToRenderPerBatch 10, every updateCellsBatchingPeriod 50 ms). If the user scrolls faster than rows render, they see blank areas.
- keyExtractor must return a stable unique id. Index keys break when items are inserted, removed or reordered: state and animations attach to the wrong row.
- initialNumToRender (default 10) should just fill the first screen. Those first items stay mounted (for fast scroll-to-top).
- Never put a vertical FlatList inside a vertical ScrollView: the outer ScrollView measures the full height, so virtualization stops. Use ListHeaderComponent and ListFooterComponent.
- SectionList adds section headers (sticky by default on iOS) on top of the same virtualization.
The red pen
Common traps: mistake → fix
Mistake: "FlatList recycles views"
Fix: FlatList unmounts and mounts rows; FlashList recycles.
Mistake: "Index as key is fine"
Fix: wrong as soon as items are removed, inserted or reordered.
Mistake: "Wrap FlatList in a ScrollView to add a header"
Fix: use ListHeaderComponent.
Easy to hard
Questions interviewers ask, easy to hard
- How does FlatList decide which rows to render?
- Why is an index key a bug? Show a case.
- What does windowSize 21 mean? What happens at 3? At 100?
- Why is a FlatList inside a ScrollView a problem?
- Why do you see blank areas when you scroll fast?
Practise
Practise with these questions
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceYour first interview is free
Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.