talalmajali / react-native-countdown-component

React Native CountDown
MIT License
266 stars 233 forks source link

I find that the component cannot reset the time if the time ends #52

Closed FTD-ZF closed 4 years ago

FTD-ZF commented 5 years ago

At the end of the first time, go to the onFinish method, reset the time, and transfer different id and time. Debugging finds that the new data has been passed in, but there is no new time on the component for countdown, and the "00:00:00" is still displayed.

constructor(props) { super(props); this.timeid = '1', this.state = { endtime: 3, }; } onFinish() { this.timeid = '2' this.setState({ endtime: 30, });

}

<CountDown id={this.timeid} size={12} until={this.state.endtime} onFinish={() => this.onFinish()}

                digitStyle={{ backgroundColor: 'black', borderWidth: 4, }}
                digitTxtStyle={{ color: 'white', fontSize: 14 }}
                timeLabelStyle={{ color: 'red', fontWeight: 'bold' }}
                separatorStyle={{ color: 'black' }}
                timeToShow={['H', 'M', 'S']}
                timeLabels={{ m: null, s: null }}
                showSeparator
            />
saeedtkh commented 5 years ago

I have the same problem, could you find any solution for it?

talalmajali commented 4 years ago

@saeedtkh @FTD-ZF please update the component to 2.5.1, it should be fixed now