This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.
ScrollView
A SwiftUI ScrollView component for scrollable content.
Expo UI ScrollView matches the official SwiftUI ScrollView API and provides a scrollable container for its children.
Installation
- npx expo install @expo/uiIf you are installing this in an existing React Native app, make sure to install expo in your project.
Usage
Basic vertical scroll view
A simple vertically scrollable list of text items.
import { Host, ScrollView, VStack, Text } from '@expo/ui/swift-ui'; import { padding } from '@expo/ui/swift-ui/modifiers'; export default function ScrollViewVerticalExample() { return ( <Host style={{ flex: 1 }}> <ScrollView> <VStack spacing={8}> {Array.from({ length: 30 }, (_, i) => ( <Text key={i} modifiers={[padding({ horizontal: 16 })]}> {`Item ${i + 1}`} </Text> ))} </VStack> </ScrollView> </Host> ); }
Horizontal scroll view
Use the axes prop to scroll horizontally.
import { Host, ScrollView, HStack, RoundedRectangle } from '@expo/ui/swift-ui'; import { frame, foregroundStyle } from '@expo/ui/swift-ui/modifiers'; export default function ScrollViewHorizontalExample() { return ( <Host style={{ flex: 1 }}> <ScrollView axes="horizontal"> <HStack spacing={8}> {Array.from({ length: 20 }, (_, i) => ( <RoundedRectangle key={i} cornerRadius={12} modifiers={[ frame({ width: 100, height: 100 }), foregroundStyle(`hsl(${i * 18}, 70%, 50%)`), ]} /> ))} </HStack> </ScrollView> </Host> ); }
Hidden scroll indicators
Set showsIndicators to false to hide the scroll bars.
import { Host, ScrollView, VStack, Text } from '@expo/ui/swift-ui'; export default function ScrollViewHiddenIndicatorsExample() { return ( <Host style={{ flex: 1 }}> <ScrollView showsIndicators={false}> <VStack spacing={8}> {Array.from({ length: 30 }, (_, i) => ( <Text key={i}>{`Item ${i + 1}`}</Text> ))} </VStack> </ScrollView> </Host> ); }
API
import { ScrollView } from '@expo/ui/swift-ui';
Component
Type: React.Element<ScrollViewProps>
SwiftUI ScrollView wrapper. To control scroll position, pair this with the
scrollPosition(state, { onChange }) modifier and a useNativeState-backed
id. Write state.value = targetId for an instant scroll, or wrap the write
in withAnimation(...) from @expo/ui/swift-ui for an animated one.
string • Default: 'vertical'The scrollable axes. Pass 'both' to enable 2D (horizontal + vertical) scrolling.
Acceptable values are: 'vertical' | 'horizontal' | 'both'
ReactNodeboolean • Default: trueWhether to show scroll indicators. For richer visibility control (e.g. 'never')
or per-axis control, use the scrollIndicators(...) modifier instead.
Types
Snapshot of a ScrollView's scroll geometry, emitted by the
useScrollGeometryChange(...) and onScrollPhaseChange(...) modifiers
(iOS 18+).
| Property | Type | Description |
|---|---|---|
| containerHeight | number | Height of the visible scroll container, in points. |
| containerWidth | number | Width of the visible scroll container, in points. |
| contentHeight | number | Total height of the scrollable content, in points. |
| contentOffsetX | number | Horizontal content offset, in points. |
| contentOffsetY | number | Vertical content offset, in points. |
| contentWidth | number | Total width of the scrollable content, in points. |