How does ScrollView work in React Native?

← React Native answers

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, not style, so it scrolls with the content.
  • Do not nest a vertical ScrollView inside another one with the same direction; use one scrolling container.
  • For long lists, FlatList renders only what is visible and recycles rows.

Related questions

Start debugging smarter today

Try Bugsee for free — no commitments, no hidden fees.

Free sign upLive demoNo credit card required