I want to restart at will.
Harkindey opened this issue · comments
I need to restart the countdown without changing the seconds.
Good idea, thanks for the contribution, Just see my comment at your PR #7 about the implementation details
I solved it like this
I added
restartCount(nextProps){
this.setState(getInitialState(this.props), this.restartAnimation)
}
in
react-native-countdown-circle/src/index.js
and
<CountdownCircle
ref = {ref => this.countdown = ref}
...
I can use.
this.countdown.restartCount();
You don't need the nextProps
argument, but that's how I imagined it 👍
If you like, you can create a PR
@mustafakucuk will be expecting your PR
@mustafakucuk i cant implement that, can you show me how to do this with real example maybe
The recommended way to do this is by setting a different key
as this will completely remove and remount the component. See React Blog for this pattern.