Skip to content
Native Animation
Revenue Bar Scrubber animation preview

This preview uses fictional demo content. See the props below for the customization options available in this component.

npx nativeanimation add revenue-bar-scrubber
Chart

Revenue Bar Scrubber

An interactive revenue chart with draggable daily values and configurable chart colors, labels, periods, and money formatting.

$9 for this animation

Add to your project

Copy the component and its assets into your app with the Native Animation CLI, or paste the agent prompt into Claude Code, Codex or Cursor once the MCP server is connected.

About this animation

An interactive revenue chart with draggable daily values and configurable chart colors, labels, periods, and money formatting.

How it works

One continuous day shared value drives the active bar color and scale, the bubble position, and the selected day label. A pan gesture follows the finger directly on the UI thread and springs to the nearest day on release. The bubble translates horizontally on a fixed baseline, while preformatted amounts crossfade independently inside its fixed bounds. Scrubbing does not update React state or restart a timing animation on each gesture event. Period data changes in place so the chart retains its layout and selection.

Install

npx expo install react-native-gesture-handler react-native-reanimated react-native-worklets

Usage

import RevenueBarScrubber, { type RevenueBarScrubberRef } from './RevenueBarScrubber';
import { useRef } from 'react';

export function RevenueScreen() {
  const chart = useRef<RevenueBarScrubberRef>(null);
  return <RevenueBarScrubber ref={chart} periods={weeklyPeriods} />;
}

The ref exposes selectDay(index) and setPeriod(id). The component is embeddable and does not apply safe area insets.

Props

PropTypeDescription
titlestringHeading shown above the selectors.
periodsRevenuePeriod[]Period labels, totals, deltas, average order values, and seven daily values.
currencyLabelstringCurrency selector label.
initialDaynumberInitially selected day from 0 to 6.
labels{ gross, aov, growth }Metric labels.
colors{ background, card, cardSoft, bar, barActive, ink }Complete dashboard palette.
formatMoney(value: number) => stringCurrency and number formatter.
onPeriodChange(id: string) => voidCalled after choosing a period.
onDayChange(index: number) => voidCalled after selecting a day.
onBack() => voidBack button action.
styleStyleProp<ViewStyle>Optional root style.
testIDstringRoot test identifier.

Compatibility

  • Expo SDK 58, React Native 0.88, Reanimated 4.7, and Worklets 0.13.
  • iOS, Android, and web are supported.

Accessibility

Period and day controls are labeled buttons. The back control has a descriptive label. Reduced motion selects days immediately, switches amounts without a crossfade, and removes moving stripe texture.

Why this one

The chart makes each day's value directly inspectable: drag across the bars and the active day, highlight, and amount move together without navigating away from the dashboard.