
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
react-native-countup
Advanced tools
Customizable react native component for number animations.
$ npm install react-native-countup
import AnimateNumber from 'react-native-countup'
The only required property is value, when this property changes, it automatically interpolates
value and performs animation.
<AnimateNumber value={100}/>
You can also pass in an initial value to interpolate from:
<AnimateNumber initial={50} value={100}/>
You can customize text format by specifying formatter prop, this property must be a function.
<AnimateNumber value={100} formatter={(val) => {
return '$ ' + parseFloat(val).toFixed(2)
}}/>
There're 3 built-in timing functions which are linear, easeIn, and easeOut.
It is also possible customize your timing function, see examples bellow.
<AnimateNumber value={100} timing="linear"/>
<AnimateNumber value={100} timing="easeOut"/>
<AnimateNumber value={100} timing="easeIn"/>
Customized timing function returns a number which represents the length of animation frame.
interval
Basic interval length of animation frame, default value is 14 ms. You can change this value by interval prop.
progress
A float number between 0 to 1, which means the progress of animation.
<AnimateNumber value={200}
countBy={1}
timing={(interval, progress) => {
// slow start, slow end
return interval * (1 - Math.sin(Math.PI*progress) )*10
}}/>
By default this component calculates value increment of each animation frame,
but you can customize this rule by set prop countBy.
<AnimateNumber value={100} countBy={1} />
But keep in mind if the countBy value is relative small than value, the animation may persists for a very long time.
Like the following example, it will tasks 150 seconds to finish the animation.
<AnimateNumber value={10000} interval={15} countBy={1} />
value:number(required)The value of AnimateNumber component.
countBy:number(optional default to null)Set this property to force the component's value increase/decrease by this number.
interval:number(optional default to 14)Base interval of each animation frame, in ms.
steps:number(optional default to 45)Set total frame number of animation, say, if interval is 14 and steps is 30, the animation will take 14x30ms to finish when it uses linear timing function.
timing: 'linear' | 'easeOut' | 'easeIn' | () => numberCustom timing function or use a default timing function.
formatter: () => string(optional)This prop accepts a function which returns a string as displayed value.
onProgress: () => void(optional)A function that triggers when text state has updated.
onFinish: () => void(optional)A function that triggers when animation completes.
FAQs
Customizable react native component for number animations.
The npm package react-native-countup receives a total of 95 weekly downloads. As such, react-native-countup popularity was classified as not popular.
We found that react-native-countup demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.