Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update readme with id specifics #129

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Run `npm install react-native-countdown-component --save` OR `yarn add react-nat
## Props
| Name | Description | Type | Default Value |
| :--- | :----- | :--- | :---: |
| id | Counter id, to determine whether to reset the counter or not | string | null |
| id | Counter id, to determine whether to reset the counter or not. To reset the timer, change this value | 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'`} |
Expand Down Expand Up @@ -88,9 +88,28 @@ render() {
timeLabelStyle={{color: 'red', fontWeight: 'bold'}}
separatorStyle={{color: '#1CC625'}}
timeToShow={['H', 'M', 'S']}
timeLabels={{m: null, s: null}}
timeLabels={{m: undefined, s: undefined}}
showSeparator
/>
)
}
```
## Reset Timer

To reset the timer, the `id` property must be changed. Below is a simple example.

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

const [timerId, setTimerId] = useState<string>(Math.random().toString())

const resetTimer = () => {setTimerId(Math.random().toString())}

return (
<CountDown
id={timerId}
until={45 * 60}
onPress={resetTimer}
/>
)
```