Android React Native-特定页面上的Backbutton处理程序

Android React Native-特定页面上的Backbutton处理程序,android,react-native,react-native-android,back-button,Android,React Native,React Native Android,Back Button,我有一个特定的页面 我只想使用react native禁用Android设备上的后退按钮来禁用此页面上的后退按钮 它将处理背压 import { BackHandler } from 'react-native'; constructor(props) { super(props) } componentWillMount() { BackHandler.addEventListener('hardwareBackPress', thi

我有一个特定的页面


我只想使用react native禁用Android设备上的后退按钮来禁用此页面上的后退按钮

它将处理背压

import { BackHandler } from 'react-native';

    constructor(props) {
        super(props)
    }

    componentWillMount() {
        BackHandler.addEventListener('hardwareBackPress', this.handleBackButtonClick);
    }

    componentWillUnmount() {
        BackHandler.removeEventListener('hardwareBackPress', this.handleBackButtonClick);
    }

    handleBackButtonClick = () => {
        this.props.navigation.goBack(null);
        return true;
    };

发布您到目前为止所做的工作否其不工作Component将挂载工作,但当我移动到下一页时Component将挂载不工作。我可以查看您的代码吗