📌  相关文章
📜  back press subscriptions i is not a function react native - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:05.804000             🧑  作者: Mango

代码示例1
componentDidMount() {
        this.interval = setInterval(() => this.setState({ time: this.state.time + 1 }), 1000 * 60);
        this.handler = BackHandler.addEventListener('hardwareBackPress', () => {return true})
    }

    componentWillUnmount() {
        clearInterval(this.interval)
        this.handler.remove()
        BackHandler.addEventListener('hardwareBackPress', () => {return false})
    }