Smooth number transitions for Expo.
A NumericText for Expo. When the value changes, only the characters that differ move, each on its own spring.
npx expo install expo-content-transitionHow it works
A diff, not a crossfade.
Most animated text fades the old value out and the new one in. NumericText lines the two up and moves each glyph on its own spring, in the spirit of SwiftUI's numericText transition.
Only what changed moves
Old and new text are compared glyph by glyph. 123.45 to 123.46 rolls one digit; the rest hold perfectly still.
Aligned at the decimal
Digits keep their place around the separator, with prefixes and suffixes held apart, so $9.99 to $10.49 grows a digit instead of shuffling.
Direction from the value
Bigger numbers roll up and smaller ones roll down, worked out from the values themselves. Force it for clocks and countdowns.
Playground
Every prop, live.
Drag a slider and the next change uses it. The code updates with you, down to the props you can leave out.
Transition
Blur and clipping
Typography
Only props that differ from the defaults are written. The preview runs the package's own web renderer, so this is the motion you get on the web; iOS and Android follow the same springs.
Examples
For the numbers in your app.
Balances, prices, timers, counts and labels. Each one is a few lines, and every one below is running now.
Platforms
Native where it runs.
The same diff and the same springs, ported to each platform's own renderer. Only the new string crosses the bridge; on iOS and Android the motion never touches the JavaScript thread.
- Each glyph is its own layer, driven by the display link
- System fonts, custom families and PostScript names
- iOS 16.4 and later
- Glyphs drawn and transformed in a single composable
- Feathered clipping at the line edges
- Blur on Android 12 (API 31) and later
- One element per glyph, moved with CSS transforms
- Follows prefers-reduced-motion by itself
- Through react-native-web, no extra setup
Start with one line.
Add the package, rebuild your development client, and put NumericText anywhere you’d put a Text.
npx expo install expo-content-transition