0.2.2 • Published 5 years ago

react-native-formatted-counter v0.2.2

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

React Native Formatted Counter

Forked from react-native-counter, adds support for a 'formatter' prop. You can use the formatter to modify the final displayed value of the counter.

Simple counter component for React Native inspired by react-count-to and react-counter.

gif

Installation

npm install --save react-native-formatted-counter

Usage

import Counter from 'react-native-counter';

<Counter
  end={}                        // REQUIRED End of the counter
  start={0}                     // Beginning of the counter
  time={1000}                   // Duration (in ms) of the counter
  digits={0}                    // Number of digits after the comma
  easing="linear"               // Easing function name
  onComplete={}                 // Callback when the counter is completed
  style={}                      // Custom style
  formatter={(data) => {        // Custom Formatter - returned value is displayed
    return `$${data}`;
  }}
/>

The easing prop is a string corresponding to one of any function from eases.

License

MIT