vydimitrov / react-countdown-circle-timer

Lightweight React/React Native countdown timer component with color and progress animation based on SVG

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Kill and restart the app timer restart

JP-902130 opened this issue · comments

commented

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}};
}}

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

Closing due to inactivity.