ScrollView makes its content scrollable but renders every child immediately, so use it for short content and switch to FlatList for long or unknown-length lists.
import { ScrollView, RefreshControl, Text } from 'react-native';
<ScrollView
style={{ flex: 1 }} // the scroll view itself needs a bounded height
contentContainerStyle={{ padding: 16 }} // styles the inner content, not the viewport
showsVerticalScrollIndicator={false}
keyboardShouldPersistTaps="handled" // taps reach buttons while the keyboard is open
refreshControl={<RefreshControl refreshing={loading} onRefresh={reload} />}
>
<Text>Short, fixed content goes here.</Text>
</ScrollView>
// Horizontal
<ScrollView horizontal showsHorizontalScrollIndicator={false}>{chips}</ScrollView>- If nothing scrolls, the parent usually has no fixed height. Give the scroll view or its parent
flex: 1. - Put padding in
contentContainerStyle, notstyle, so it scrolls with the content. - Do not nest a vertical
ScrollViewinside another one with the same direction; use one scrolling container. - For long lists,
FlatListrenders only what is visible and recycles rows.
