test
npm install react-native-sync-countdown``sh`
npm install react-native-sync-countdown
`sh`
yarn add react-native-sync-countdown
`js
import { CountDown } from 'react-native-sync-countdown';
// ...
const countDown = CountDown
useEffect(() => {
countDown.setTimer(60000)
countDown.getTimer((timer) => {
console.log('get timer every 1 sec', timer)
})
countDown.getTimerOnEnd(() => {
console.log('timer end',)
})
return () => countDown.resetTimer()
}, [])
`
js
countDown.setTimer(60000) // in miliseconds
`getTimer
getTimer will be trigger every 1 second
`js
countDown.getTimer((timer) => {
console.log('get timer every 1 sec', timer)
})
`getTimerOnEnd
getTimerOnEnd will be trigger once duration is 0
`js
countDown.getTimerOnEnd(() => {
console.log('timer end',)
})
`resetTimer
Stop and set duration to 0
`js
countDown.resetTimer()
``See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT
---
Made with create-react-native-library