About this component
Related guides
A rolling number display with independent digit springs and configurable value, formatting, font, and color.
How it works
- The value is formatted with
Intl.NumberFormat, so currency, percent, grouping and fixed digits all work. - Every digit is a 0–9 wheel clipped to one line; it springs to its digit (stiffness 200, damping 20, mass 0.4).
- Digits are keyed from the right, so units stay units when the number gains a digit.
- Tabular figures keep the width steady while digits roll.
Install
npx nativeanimation add base-sliding-numberThe CLI also copies base-theme. Dependencies, if you copy by hand:
npx expo install react-native-reanimated react-native-workletsUsage
import { BaseSlidingNumber } from './base-sliding-number';
<BaseSlidingNumber value={followers} fontSize={40} />Currency and a two-digit timer:
<BaseSlidingNumber value={total} format={{ style: 'currency', currency: 'USD' }} fontSize={24} />
<BaseSlidingNumber value={seconds} format={{ minimumIntegerDigits: 2 }} />Wrap your app in BaseThemeProvider (from base-theme) to choose light/dark and an accent; without it, pieces use the light neutral theme. Every piece also takes a theme prop that wins over the provider.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
value | number | — | The number to show. |
format | Intl.NumberFormatOptions | — | Formatting (currency, digits…). |
locale | string | 'en-US' | Locale for formatting. |
fontSize / lineHeight | number | 24 / 1.25× | Type size and the height of each wheel. |
color / fontFamily | string | theme | Text color and font. |
theme | BaseTheme | provider | Overrides the theme from BaseThemeProvider. |
testID | string | — | Test identifier on the root view. |
Compatibility
Expo SDK 58 · React Native 0.88 · Reanimated 4.7 · react-native-worklets 0.13. Runs on iOS, Android and web, in Expo Go
and in development builds. Part of Native Animation Base, a free family that shares one theme: install
base-theme once (the CLI does it for you) and every Base piece picks it up.
Accessibility
Screen readers read the formatted value as one label, not digit by digit. With Reduce Motion on, digits change without rolling.
Part of a shared foundation
Use it in a screen
Compose Base Sliding Number with other Base components and a single shared theme. Ask your agent to read each API, then connect real navigation, state, and callbacks.
Go further.
Base covers the everyday. Choose a more expressive interaction when your app calls for it.
Bubble Sale Banner ↗
A sale banner with jumping balloon letters and a printing receipt, with configurable copy, character artwork, fonts, and colors.
Another way to solve this task · $9Year Digits Rollover ↗
An interactive year reveal with alternating bands on changing digits, with configurable start year, end year, colors, and numeral font asset.
Source code
Loading public source…









