2.7.1 • Published 4 years ago

react-native-countdown-component v2.7.1

Weekly downloads
4,886
License
-
Repository
github
Last release
4 years ago

react-native-countdown

React Native CountDown

Installation

Run npm install react-native-countdown-component --save OR yarn add react-native-countdown-component --save

Props

NameDescriptionTypeDefault Value
idCounter id, to determine whether to reset the counter or notstringnull
styleOverride the component styleobject{}
digitStyleDigit styleobject{backgroundColor: #FAB913 '#FAB913'}
digitTxtStyleDigit Text styleobject{color: #FAB913 '#000'}
timeLabelStyleTime Label styleobject{color: #FAB913 '#000'}
separatorStyleSeparator styleobject{color: #FAB913 '#000'}
sizeSize of the countdown componentnumber15
untilNumber of seconds to countdownnumber0
onFinishWhat function should be invoked when the time is 0funcnull
onChangeWhat function should be invoked when the timer is changingfuncnull
onPressWhat function should be invoked when clicking on the timerfuncnull
timeToShowWhat Digits to showarray'D', 'H', 'M', 'S'
timeLabelsText to show in time labelobject{d: 'Days', h: 'Hours', m: 'Minutes', s: 'Seconds'}
showSeparatorShould show separatorboolfalse
runninga boolean to pause and resume the componentbooltrue

Preview

React Native Countdown

Code

import CountDown from 'react-native-countdown-component';

render() {
    return (
      <CountDown
        until={10}
        onFinish={() => alert('finished')}
        onPress={() => alert('hello')}
        size={20}
      />
    )
}

Custom Styling Example

React Native Countdown

Code

import CountDown from 'react-native-countdown-component';

render() {
    return (
      <CountDown
        until={60 * 10 + 30}
        size={30}
        onFinish={() => alert('Finished')}
        digitStyle={{backgroundColor: '#FFF'}}
        digitTxtStyle={{color: '#1CC625'}}
        timeToShow={['M', 'S']}
        timeLabels={{m: 'MM', s: 'SS'}}
      />
    )
}

Separator Example

React Native Countdown

Code

import CountDown from 'react-native-countdown-component';

render() {
    return (
      <CountDown
        size={30}
        until={1000}
        onFinish={() => alert('Finished')}
        digitStyle={{backgroundColor: '#FFF', borderWidth: 2, borderColor: '#1CC625'}}
        digitTxtStyle={{color: '#1CC625'}}
        timeLabelStyle={{color: 'red', fontWeight: 'bold'}}
        separatorStyle={{color: '#1CC625'}}
        timeToShow={['H', 'M', 'S']}
        timeLabels={{m: null, s: null}}
        showSeparator
      />
    )
}
2.7.1

4 years ago

2.6.0

5 years ago

2.5.2

5 years ago

2.5.1

5 years ago

2.5.0

5 years ago

2.4.0

5 years ago

2.3.0

5 years ago

2.2.0

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.0

5 years ago

1.8.3

5 years ago

1.8.2

6 years ago

1.8.1

6 years ago

1.8.0

6 years ago

1.7.3

6 years ago

1.7.2

6 years ago

1.7.1

6 years ago

1.7.0

6 years ago

1.6.1

6 years ago

1.6.0

6 years ago

1.5.1

6 years ago

1.5.0

6 years ago

1.4.0

6 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago