vydimitrov / react-countdown-circle-timer

Lightweight React/React Native countdown timer component with color and progress animation based on SVG
MIT License
692 stars 87 forks source link

Kill and restart the app timer restart #238

Closed JP-902130 closed 1 year ago

JP-902130 commented 1 year ago

I am creating a timer and set the during the (session stop time - the current time). This logic is working until I kill the app and come back again. The timer is restarted to the initial state. How should I resolve this issue? Thanks <CountdownCircleTimer isPlaying duration={(currentUserRedux.session.stopTime - Date.now()) / 1000} colors={["#004777", "#F7B801", "#A30000", "#A30000"]} colorsTime={[7, 5, 2, 0]} size={50} strokeWidth={6} onComplete={() => { handleStopSessionClick(); }}

{({ remainingTime }) => { const hours = Math.floor(remainingTime / 3600); const minutes = Math.floor((remainingTime % 3600) / 60); return {${hours}:${minutes}}; }}

vydimitrov commented 1 year ago

Check the props, there is a prop initialRemainingTime you can use.

vydimitrov commented 1 year ago

Closing due to inactivity.