BNA

BNA UI
22

ScrollView

A scrollable view component that allows content to be scrolled when it exceeds the container size.

Installation

pnpm dlx bna-ui add scroll-view

Usage

import { ScrollView } from '@/components/ui/scroll-view';
<ScrollView>
  <Text>Your scrollable content here</Text>
</ScrollView>

Examples

Default

Vertical Scrolling

Horizontal Scrolling

Nested ScrollViews

With Pull to Refresh

Custom Styling

Scroll Indicators

Content Inset

API Reference

ScrollView

A wrapper around React Native's ScrollView with enhanced styling capabilities.

PropTypeDefaultDescription
styleViewStyle-Additional styles to apply to the scroll view.
contentContainerStyleViewStyle-Styles applied to the scroll view content container.
horizontalbooleanfalseWhen true, the scroll view's children are arranged horizontally.
showsVerticalScrollIndicatorbooleantrueWhen true, shows a vertical scroll indicator.
showsHorizontalScrollIndicatorbooleantrueWhen true, shows a horizontal scroll indicator.
scrollEnabledbooleantrueWhen false, the content does not scroll.
bouncesbooleantrueWhen true, the scroll view bounces when it reaches the end.
bouncesZoombooleantrueWhen true, gestures can drive zoom past min/max.
alwaysBounceVerticalbooleanfalseWhen true, the scroll view bounces vertically even when content is smaller.
alwaysBounceHorizontalbooleanfalseWhen true, the scroll view bounces horizontally even when content is smaller.
pagingEnabledbooleanfalseWhen true, the scroll view stops on multiples of the scroll view's size.
scrollEventThrottlenumber-Controls how often the scroll event will be fired while scrolling.
onScrollfunction-Fires at most once per frame during scrolling.
onScrollBeginDragfunction-Called when the user begins to drag the scroll view.
onScrollEndDragfunction-Called when the user stops dragging the scroll view.
onMomentumScrollBeginfunction-Called when the momentum scroll starts.
onMomentumScrollEndfunction-Called when the momentum scroll ends.
refreshControlRefreshControl-A RefreshControl component for pull-to-refresh functionality.
keyboardDismissMode'none' | 'on-drag' | 'interactive''none'Determines when the keyboard is dismissed.
keyboardShouldPersistTaps'always' | 'never' | 'handled''never'Determines when the keyboard should stay visible after a tap.

All other props from React Native's ScrollView are also supported.

Accessibility

The ScrollView component maintains React Native's built-in accessibility features:

  • Automatically announces scrollable content to screen readers
  • Supports gesture-based navigation for users with accessibility needs
  • Maintains proper focus management during scrolling
  • Compatible with VoiceOver and TalkBack
  • Supports dynamic text sizing and high contrast modes