React Native · Mobile UI at native speed
When do you use FlatList instead of ScrollView?
Short answer
Use ScrollView for a small, bounded amount of content that should all mount. Use FlatList for long or dynamic lists because it virtualises rows and only renders a window around the viewport.
ScrollView renders all of its children immediately and keeps them mounted. That is fine for a settings screen or a short article, but for hundreds of rows it wastes memory and startup time. FlatList renders a window of items and recycles as the user scrolls.
- ScrollView: static content, few children, mixed layouts, or content that must all exist for measurement
- FlatList: homogeneous rows, large datasets, dynamic data, pull to refresh and pagination
- SectionList: grouped data with sticky or non-sticky section headers
- FlashList: very large lists where recycling performance matters
import { FlatList, Text } from "react-native";
export function Messages({ messages }: { messages: { id: string; body: string }[] }) {
return (
<FlatList
data={messages}
keyExtractor={(item) => item.id}
renderItem={({ item }) => <Text>{item.body}</Text>}
onEndReached={() => console.log("load more")}
onEndReachedThreshold={0.5}
/>
);
}Do not nest a FlatList inside a ScrollView with the same orientation. The inner list gets an unbounded height and virtualization breaks, often with a warning. If you need mixed content, use ListHeaderComponent and ListFooterComponent on the FlatList instead.
Follow-ups you should expect
Interviewers use these to check whether the first answer was understanding or memorisation.
- 1What happens when you nest a FlatList in a ScrollView?
- 2How do you render a header above a FlatList?
- 3When is SectionList a better fit?
- 4How do you implement infinite scrolling?
Say it in the interview
ScrollView mounts all children, so I use it only for short, bounded content. For long or dynamic collections I use FlatList, which virtualises rows and gives me pagination and refresh hooks. I avoid nesting a FlatList inside a ScrollView because the inner list loses its height constraint and virtualization stops working; instead I use the list header and footer slots.
Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.
Related questions
Reading is step one
Now say it out loud.
Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live React Native mock interview and get scored feedback on depth, clarity and confidence.