Closed ashishd751 closed 7 years ago
The task should be registered at the very top level of your JS file. If you want to determine whether a button has been pressed, you'll have to use something like AsyncStorage to communicate between the main app and the background task.
I'm working on a new API now (PR #5) which will allow you to define the task separately from scheduling it. So while you'll still need to define the function body outside your components, you can schedule it in an onPress
as you were trying to do above.
Somehow the task written under the register() method never gets called ! Below is my code, please let me know what i'm doing wrong.
` <TouchableNativeFeedback onPress={() => { //this.interval = setInterval(this.tick(), 1000);
this.setState({ timerStarted : true }) } } background={TouchableNativeFeedback.SelectableBackground()}>
`