A beautiful, high-performance animated number transition component for React Native. Perfect for displaying counters, prices, statistics, and any numeric values with style! 💫
- 🚀 Smooth, fluid animations powered by React Native Reanimated
- 🎨 Highly customizable styles and animations
- 📱 Cross-platform support (iOS & Android)
- 🔧 Easy to configure animation parameters
- ⚡️ Optimized performance
- 🎯 TypeScript support
- 📦 Zero dependencies (except for React Native Reanimated)
# Using npm
npm install rn-number-flow
# Using yarn
yarn add rn-number-flow
Make sure you have react-native-reanimated installed and configured in your project.
import NumberFlow from 'rn-number-flow';
// Basic usage
<NumberFlow value="1234" />
// With custom styling
<NumberFlow
value="1234.56"
style={{ fontSize: 24, color: '#007AFF' }}
separatorStyle={{ color: '#666' }}
/>
// With custom animation config
<NumberFlow
value="9999"
animationConfig={{
enabled: true,
animateOnMount: true,
digitDelay: 50,
mass: 0.8,
stiffness: 75,
damping: 15
}}
/>
Prop | Type | Default | Description |
---|---|---|---|
value |
string | - | The numeric value to display |
style |
TextStyle | - | Style for the digits |
separatorStyle |
TextStyle | - | Style for non-numeric characters (like commas, decimals) |
autoFitText |
boolean | false | Enable/disable text auto-fitting based on ascender |
animationConfig |
AnimationConfig | - | Configuration for animations |
Option | Type | Default | Description |
---|---|---|---|
enabled |
boolean | true | Enable/disable animations |
animateOnMount |
boolean | true | Animate on initial render |
digitDelay |
number | 20 | Delay between digit animations (ms) |
mass |
number | 0.8 | Spring animation mass |
stiffness |
number | 75 | Spring animation stiffness |
damping |
number | 15 | Spring animation damping |
reduceMotion |
ReduceMotion | System | Respect system's reduce motion settings |
import NumberFlow from 'rn-number-flow';
function Counter() {
const [count, setCount] = useState(0);
return (
<View>
<NumberFlow value={count.toString()} />
<Button title="Increment" onPress={() => setCount(c => c + 1)} />
</View>
);
}
<NumberFlow
value="$1,234.99"
style={{ fontSize: 32, fontWeight: 'bold' }}
separatorStyle={{ color: '#666' }}
animationConfig={{ digitDelay: 50 }}
/>
Contributions are welcome! Feel free to open issues and submit PRs.
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request
MIT
Made with ❤️ for the React Native community.