Number Flow React Native
Components

NumberFlow

View-based animated number component with full Intl.NumberFormat support

NumberFlow is the View-based animated number component. It renders using React Native Animated Views with Reanimated SharedValues — no extra dependencies beyond react-native-reanimated. Each digit position contains a virtual wheel of digits 0–9, and transitions are achieved by translating the wheel's Y position.

Import

import { NumberFlow } from 'number-flow-react-native';

Basic Usage

Every time price changes, each digit rolls independently to its new value.

Props

Value props

PropTypeDefaultDescription
valuenumber(required)Numeric value to display.
formatIntl.NumberFormatOptionsundefinedOptions passed to Intl.NumberFormat — currencies, percentages, compact notation, scientific, units, etc.
localesIntl.LocalesArgumentundefinedLocale(s) for Intl.NumberFormat. Controls grouping separators, decimal marks, currency symbol placement, and numeral system.

Style props

PropTypeDefaultDescription
styleTextStyleundefinedText styling. fontSize defaults to 16 when omitted; fontFamily defaults to the platform system font. textAlign defaults to "left". Accepts any TextStyle property.
prefixstring""Static string prepended before the number. Animates in/out when added or removed.
suffixstring""Static string appended after the number. Animates in/out when added or removed.
digitsRecord<number, { max: number }>undefinedPer-position digit constraints. Position 0 = ones, 1 = tens, 2 = hundreds, etc. Each entry defines { max: N } (1–9) as the highest value for that digit wheel.
containerStyleViewStyleundefinedStyle applied to the outer container View.

Animation behavior props

PropTypeDefaultDescription
trendTrend | ((prev: number, next: number) => Trend)autoDigit spin direction. 1 = always up, -1 = always down, 0 = shortest path per digit. Or a function receiving (prev, next) returning the direction. Auto-detects from value changes when omitted.
animatedbooleantrueSet to false to disable all animations and update instantly.
respectMotionPreferencebooleantrueDisables animations when the device "Reduce Motion" setting is on.
continuousbooleanfalseWhen true, unchanged lower-significance digits spin through a full cycle during transitions, making the number appear to pass through intermediate values.
maskbooleantrueEnable edge gradient fade on digit slots. When @rednegniw/masked-view is installed, uses a MaskedView for smooth spatial gradient masking. Otherwise falls back to per-digit opacity fading. Set to false to disable masking entirely.
transformTimingTimingConfig900ms decelerationTiming for layout transforms (position, width changes). Uses NumberFlow's signature deceleration curve.
spinTimingTimingConfigFalls back to transformTimingTiming for digit spin/rolling.
opacityTimingTimingConfig450ms ease-outTiming for enter/exit opacity transitions.
onAnimationsStart() => voidundefinedCalled when update animations begin.
onAnimationsFinish() => voidundefinedCalled when all update animations complete.

Type references

type TimingConfig = {
  duration: number;
  easing: EasingFunction; // (t: 0→1) => 0→1
};

type Trend = -1 | 0 | 1;
type TrendProp = Trend | ((prev: number, next: number) => Trend);

Accessibility

NumberFlow automatically sets accessibilityRole="text" and an accessibilityLabel with the full formatted value. Screen readers announce the complete number (e.g. "$42.99") rather than individual digit changes.

On this page