ExpoStartup

ThemeScroller

A scrollable container that adapts to the current theme.

ThemeScroller

A themed ScrollView component that provides consistent styling and behavior with automatic light/dark mode support.

Import

import ThemeScroller, { AnimatedScrollView } from '@/components/ThemeScroller';

Features

  • Automatic light/dark mode adaptation
  • Hidden vertical scroll indicator
  • Built-in bottom spacing
  • Optional header space for fixed headers
  • Support for animated scrolling events
  • Customizable via Tailwind classes

Props

PropTypeDefaultDescription
childrenReact.ReactNodeRequiredContent to display
classNamestring''Additional Tailwind classes
onScrollFunctionScroll event handler
contentContainerStyleanyStyles for content container
scrollEventThrottlenumber16Scroll event throttle rate
headerSpacebooleanfalseAdd space for fixed header
...propsScrollViewPropsAdditional ScrollView props

Basic Usage

// Basic usage
<ThemeScroller>
  <ThemedText>Scrollable content here</ThemedText>
  {/* More content */}
</ThemeScroller>
 
// With header space and custom className
<ThemeScroller 
  headerSpace 
  className="pb-4"
>
  <ThemedText className="text-lg mb-4">
    Content with space for a fixed header
  </ThemedText>
  {/* More content */}
</ThemeScroller>
 
// With scroll event handling
<ThemeScroller
  onScroll={handleScroll}
  scrollEventThrottle={8}
  contentContainerStyle={{ paddingBottom: 40 }}
>
  <ThemedText>Scroll-tracked content</ThemedText>
  {/* More content */}
</ThemeScroller>
 
// Using the AnimatedScrollView
<AnimatedScrollView
  onScroll={Animated.event(
    [{ nativeEvent: { contentOffset: { y: scrollY } } }],
    { useNativeDriver: true }
  )}
  className="bg-light-primary dark:bg-dark-primary"
>
  <ThemedText>Content for animated scrolling effects</ThemedText>
  {/* More content */}
</AnimatedScrollView>

On this page