FlatList

Also called Virtualised list

Updated

What is FlatList in React Native?

FlatList is React Native’s virtualised list component. It renders only the rows near the viewport, keeping memory flat no matter how long the data is.

3839404142434445
Row on screenMounted rowRender window edgeFlatList mounts only the rows inside its render window around the viewport and recycles them as you scroll, so the number of native views stays flat whether the data has ten rows or a thousand. A ScrollView mounts every child up front. The real default window (windowSize: 21) is 21 viewports tall; it is shrunk here so you can watch rows recycle. Stable keyExtractor ids, getItemLayout for fixed-height rows and a memoised row component are what keep it fast.

FlatList renders long lists efficiently by only mounting the rows near the viewport and recycling them as the user scrolls. A ScrollView mounts every child immediately, so a thousand-row list built from one would allocate a thousand native views up front.

<FlatList data={posts} keyExtractor={(item) => item.id} renderItem={({ item }) => <PostRow post={item} />} />

The props that decide whether it performs:

  • keyExtractor — stable ids, for the same reasons keys matter anywhere
  • getItemLayout — skips measurement when rows are a fixed height
  • initialNumToRender — how much to render before the first paint

The usual newcomer mistake is an inline renderItem arrow that recreates every row component on each render; memoising the row is the standard fix.

For heavy lists many teams use FlashList from Shopify, a drop-in-shaped alternative with better recycling. Rule of thumb: ScrollView for a handful of known items, FlatList for anything data-driven.