React Native · Performance
Fixing scroll jank by tuning list virtualization, not rewriting the screen
A long, image-heavy list was janky on mid-range Android devices. The fix wasn’t a new list library
or a redesign — it was making the existing FlatList mount only what the viewport
actually needed, and feeding it the layout information it was missing.
Context
A feed-style screen (think: order history, activity feed, chat-like list) rendered a few thousand rows, each with an avatar, two lines of text and a status pill. On iOS it felt acceptable; on mid-range Android it stuttered on scroll, took a visible beat to respond to fast flicks, and occasionally dropped frames hard enough that users reported the screen as “frozen.”
Problem
The list was already using FlatList, so the instinct was to blame the library. The real
issue was upstream of it: every row was an uncached component tree re-created on each render, there was
no getItemLayout so the list couldn’t predict row size, and the default window
settings were left untouched on a dataset an order of magnitude larger than what they’re tuned
for out of the box. Virtualization was technically on; in practice the list was mounting far more rows
than the viewport needed and re-laying-out constantly.
Approach — make the window do its job
- Fixed row height first. Every row was already a consistent height, so adding
getItemLayoutlet the list compute offsets instead of measuring, which removes a whole class of layout thrash on fast scroll. - Stable keys and memoized rows. Switched from array index keys to a stable
keyExtractorand wrapped the row component inReact.memowith a tight equality check, so scrolling didn’t re-render rows that hadn’t changed. - Tuned the window, not just the defaults. Lowered
initialNumToRenderto match the real viewport, raisedmaxToRenderPerBatchslightly to avoid empty-row flashes on fast flicks, and setwindowSizedeliberately instead of leaving it at the default guess. - Clipped off-screen views. Enabled
removeClippedSubviewson Android, where it meaningfully reduces the native view count for long lists. - Measured before reaching for a new library. Only after this was still not enough on the heaviest screen did migrating that one screen to
FlashList(recycling views instead of mounting/unmounting) get evaluated — and it was scoped to where profiling actually showed the win, not applied blindly everywhere.
Illustrative outcome
Figures below are illustrative, from profiling a representative feed screen during this work — not a specific client’s production metrics.
- Rows mounted at rest dropped from roughly the full visible-plus-buffer default to a tightly bounded window matching
windowSize. - Dropped-frame reports on the screen fell noticeably on the mid-range Android devices used for QA, with the biggest gain coming from
getItemLayoutplus memoized rows — beforeFlashListwas even on the table. - Fast-flick scrolling no longer showed empty row flashes, because batch size and window size were sized for how users actually scrolled the screen, not left at generic defaults.
What I took from it
“We’re already using FlatList” is not the same as the window being tuned for
the data you actually have. The highest-leverage fixes were layout information and memoization —
both free, both unrelated to swapping libraries. Reaching for a different list implementation is a real
option, but it’s worth earning with a profile, not reaching for first.
The interactive demo below makes the mechanism visible: toggle windowing on a few thousand rows and watch mounted DOM nodes and estimated render cost move together, the same relationship that drives scroll performance in a native list.