Skip to content

stopBackgroundTimer not working #310

Open
@sankomil

Description

@sankomil

Hi, I was creating a simple timer screen for an app and was using the library to update the timer every minute as so:


const [timer,setTimer]=useState(moment(new Date()).format('hh:mm:ss A (DD/MM/YYYY)');

BackgroundTimer.runBackgroundTimer(() => { 
//code that will be called every 3 seconds 
setTimer(moment(new Date()).format('hh:mm:ss A (DD/MM/YYYY)');
}, 
60000);

And have a button element, which when pressed should stop the timer, like so:


<Button onPress={()=>{BackgroundTimer.stopBackgroundTimer(); }}>Stop</Button>

However despite pressing the button, the timer does not stop and continues to update the app.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions