ScrollView

Provide the viewport for a scrollable page.

App.tsx
<View layout={{ flex: 1 }}>  <Text>Trail itinerary</Text>  <ScrollView>    <ScrollViewContent>      {stops}    </ScrollViewContent>  </ScrollView></View>
Trail itinerary

Station garden

Orchard gate

Willow bridge

Old mill

Riverside path

North meadow

Hilltop bench

Lake shore

Scroll the stops inside the phone. The itinerary title stays in place.

Place a single ScrollViewContent directly inside the viewport. The viewport defaults to flex: 1 and clips overflowing content. Give its parent a bounded height so that content extending beyond the viewport can scroll.

Scroll several sections together

Give the content padding when the first and last sections need space at the edges. That padding moves with the paragraphs as the reader scrolls.

import { ScrollView, ScrollViewContent, Text } from 'react-nitro-renderer'

type Paragraph = { id: string; text: string }

export function NoteBody({ paragraphs }: { paragraphs: Paragraph[] }) {
  return (
    <ScrollView layout={{ flex: 1 }}>
      <ScrollViewContent layout={{ padding: 20 }}>
        {paragraphs.map((paragraph) => (
          <Text key={paragraph.id} layout={{ marginBottom: 12 }}>{paragraph.text}</Text>
        ))}
      </ScrollViewContent>
    </ScrollView>
  )
}

Place a header or toolbar beside the ScrollView in the outer layout to keep it fixed. Put it inside ScrollViewContent if it should scroll away with the page.

Hide the scroll indicators

Both scroll indicators show by default. Set showsVerticalScrollIndicator or showsHorizontalScrollIndicator to false to hide one, for example on a short page where the indicator only adds noise.

<ScrollView layout={{ flex: 1 }} showsVerticalScrollIndicator={false}>
  <ScrollViewContent layout={{ padding: 20 }}>{children}</ScrollViewContent>
</ScrollView>

Pad for the safe area yourself

On iOS the scroll view adds safe-area insets to its scrollable area, like UIScrollView's automatic behavior. Inside a navigation stack this includes the space under the navigation bar. If the content already pads for the safe area, set contentInsetAdjustmentBehavior to never so the space is not added twice. Android ignores the prop.

const insets = useSafeAreaInsets()

<ScrollView layout={{ flex: 1 }} contentInsetAdjustmentBehavior="never">
  <ScrollViewContent layout={{ padding: 20, paddingTop: insets.top + 20, paddingBottom: insets.bottom + 20 }}>
    {children}
  </ScrollViewContent>
</ScrollView>

Use this layout for an article, form, or short collection where you want every child in the view tree. For a long feed, give List its own bounded viewport so its native host can recycle rows. ScrollViewContent · List

On this page