# react-native-countdown-component

> React Native CountDown Component

Latest version **2.7.1** (published 2020-03-13) · 0 weekly downloads

## Install

```sh
npm install react-native-countdown-component
pnpm add react-native-countdown-component
yarn add react-native-countdown-component
bun add react-native-countdown-component
```

## Health

**Score 18/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.7.1 |
| Published | 2020-03-13 |
| First published | 2017-12-03 |
| Weekly downloads | 0 |
| TypeScript types | separate (@types/react-native-countdown-component) |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 15.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 277 |
| Author | Talal Majali |
| Maintainers | talalmajali |
| Keywords | react-native, react-component, react-native-component, react, mobile, ios, android, counter, countdown |

## Links

- npm: https://www.npmjs.com/package/react-native-countdown-component
- Repository: https://github.com/talalmajali/react-native-countdown-component
- Issues: https://github.com/talalmajali/react-native-countdown-component/issues
- npm.io page: https://npm.io/package/react-native-countdown-component

## Dependencies (3)

- [lodash](https://npm.io/package/lodash.md) ^4.17.13
- [prop-types](https://npm.io/package/prop-types.md) ^15.5.8
- [sprintf-js](https://npm.io/package/sprintf-js.md) ^1.1.1

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 2.7.1 (latest) — 2020-03-13
- 2.6.0 — 2019-09-27
- 2.5.2 — 2019-07-31
- 2.5.1 — 2019-07-27
- 2.5.0 — 2019-06-08
- 2.4.0 — 2019-04-24
- 2.3.0 — 2019-04-24
- 2.2.0 — 2019-02-22
- 2.1.1 — 2019-02-09
- 2.1.0 — 2019-02-09
- 2.0.0 — 2019-01-13
- 1.8.3 — 2018-11-20
- 1.8.2 — 2018-10-05
- 1.8.1 — 2018-10-05
- 1.8.0 — 2018-10-05
- … 13 more at https://npm.io/package/react-native-countdown-component/versions

## README

# react-native-countdown
React Native CountDown

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

## Props
| Name | Description | Type | Default Value |
| :--- | :----- | :--- | :---: |
| id | Counter id, to determine whether to reset the counter or not | string | null |
| style | Override the component style | object | {} |
| digitStyle |  Digit style | object | {backgroundColor: ![#FAB913](https://placehold.it/15/FAB913/000000?text=+) `'#FAB913'`} |
| digitTxtStyle | Digit Text style | object | {color: ![#FAB913](https://placehold.it/15/000000/000000?text=+) `'#000'`} |
| timeLabelStyle | Time Label style | object | {color: ![#FAB913](https://placehold.it/15/000000/000000?text=+) `'#000'`} |
| separatorStyle | Separator style | object | {color: ![#FAB913](https://placehold.it/15/000000/000000?text=+) `'#000'`} |
| size | Size of the countdown component | number | 15 |
| until | Number of seconds to countdown | number | 0 |
| onFinish | What function should be invoked when the time is 0 | func | null |
| onChange | What function should be invoked when the timer is changing | func | null |
| onPress | What function should be invoked when clicking on the timer | func | null |
| timeToShow | What Digits to show | array | ['D', 'H', 'M', 'S'] |
| timeLabels | Text to show in time label | object | {d: 'Days', h: 'Hours', m: 'Minutes', s: 'Seconds'} |
| showSeparator | Should show separator | bool | false |
| running | a boolean to pause and resume the component | bool | true |


## Preview

![React Native Countdown](https://media.giphy.com/media/xT0xeLWYNSaLerFGko/giphy.gif "React Native Countdown")

## Code
```javascript
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](https://media.giphy.com/media/wIwc1dinsZhx6v2PxB/giphy.gif "React Native Countdown")

## Code
```javascript
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](https://media.giphy.com/media/4H7qQF4UPwQKEc0Qpx/giphy.gif "React Native Countdown")


## Code
```javascript
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
      />
    )
}
```

---
_Source: https://npm.io/package/react-native-countdown-component · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
