Skip to content

ScrollView

const ScrollView: ForwardRefExoticComponent<ScrollViewProps & RefAttributes<ScrollViewHandle>>;

Scrollable container.

Supports three modes:

  1. Array children (default) — all children rendered, overflow clipped. Yoga has every layout position, so follow-focus is pixel-perfect.
  2. Virtualized array (virtualize prop) — only visible items mounted (sliding window). Good for huge lists where rendering everything would be too expensive.
  3. Line virtualization — pass a render function + totalLines.

Auto-scrolls to keep the focused child visible when scrollToFocus is true (default).

Keyboard shortcuts (when the ScrollView or a child has focus):

KeyAction
Page Up / Page DownScroll one page
Ctrl+D / Ctrl+UHalf-page down / up
Ctrl+F / Ctrl+BFull-page down / up
// Basic scrollable list — all children rendered, overflow clipped
<ScrollView style={{ height: 10, border: "round" }}>
{items.map((item) => (
<Text key={item.id}>{item.name}</Text>
))}
</ScrollView>
// Virtualized list — only visible items mounted
<ScrollView virtualize style={{ height: 10, border: "round" }}>
{items.map((item) => (
<Text key={item.id}>{item.name}</Text>
))}
</ScrollView>
// Line-based virtualization with render function
<ScrollView totalLines={100_000} style={{ height: 20 }}>
{({ start, end }) =>
Array.from({ length: end - start }, (_, i) => (
<Text key={start + i}>Line {start + i}</Text>
))
}
</ScrollView>

PropertyTypeDescription
children?ReactNode | (range) => ReactNodeChildren to render. Can also be a render function (range: VisibleRange) => ReactNode for line-based virtualization.
defaultScrollOffset?numberInitial offset for uncontrolled mode
disableKeyboard?booleanDisable keyboard scrolling
estimatedItemHeight?numberEstimated height per child in lines (default: 1). Only used in virtualized mode for initial scroll calculations before actual heights are measured.
focusable?booleanMake ScrollView itself focusable. Default: true. Set to false if you want scroll to follow child focus only.
focusedStyle?StyleStyle applied when ScrollView is focused
onScroll?(offset) => voidCallback when scroll offset should change (controlled mode)
overscan?numberExtra lines to render above/below viewport (default: 2)
scrollOffset?numberControlled scroll offset (rows from top)
scrollStep?numberLines to scroll per arrow key press (default: 1)
scrollToFocus?booleanAuto-scroll to focused element (default: true)
showScrollbar?booleanShow scrollbar when content is scrollable (default: true)
style?Style-
totalLines?numberTotal content height in lines (for render function mode). When set with a render function, enables line-based virtualization.
virtualize?booleanEnable sliding-window virtualization for array children. When true, only visible items (+ overscan) are mounted. When false (default), all children are rendered and clipped — like browser overflow scrolling. This gives Yoga full layout info so scrollIntoView / follow-focus positions are always accurate.

Visible range passed to the render function in virtualized mode. Contains the start/end indices and viewport metadata.

PropertyTypeDescription
endnumberOne past the last visible line index
scrollOffsetnumberCurrent scroll offset
startnumberFirst visible line index (0-based)
viewportHeightnumberViewport height in lines