ZUI

Search documentation

Find a page or a heading.

Scroll area

A box of fixed size whose content scrolls inside it.

Installation

bash

The CLI writes components/ui/scroll-area.tsx and installs Utils.

Usage

tsx
tsx

To scroll sideways, add a horizontal ScrollBar, as upstream does:

tsx

API reference

ScrollArea

Takes every prop of React Native's ScrollView. Give it a height, or a width for a sideways one. It scrolls vertically, or sideways when it holds a horizontal ScrollBar or is given horizontal. Inside a scrolling screen it keeps scrolling on Android (nestedScrollEnabled).

ScrollBar

It sets the axis of the ScrollArea it sits in and draws nothing itself.

Differences from upstream

  • Upstream draws its own scrollbar with a rounded thumb in the border colour. A ScrollView's indicator is the platform's and cannot be styled, so the native ScrollBar draws nothing and the style's scrollbar and thumb classes are not used.
  • Upstream can scroll both ways at once, with a vertical and a horizontal scrollbar. A ScrollView scrolls along one axis; nest a horizontal ScrollArea in a vertical one to scroll both ways.
  • Upstream's viewport draws a focus ring when focused from the keyboard. The native ScrollArea draws none.