1componentDidMount() {
2 this.interval = setInterval(() => this.setState({ time: this.state.time + 1 }), 1000 * 60);
3 this.handler = BackHandler.addEventListener('hardwareBackPress', () => {return true})
4 }
5
6 componentWillUnmount() {
7 clearInterval(this.interval)
8 this.handler.remove()
9 BackHandler.addEventListener('hardwareBackPress', () => {return false})
10 }