Android-Handle Back Button2019-06-24 17:19Dev, JavaScript, React Native

Below Codes Requires Confirmation

  import {
    BackHandler,
  } from 'react-native';
  
  class SearchScreen extends React.Component {

    componentDidMount() {
      this.backHandler = BackHandler.addEventListener('hardwareBackPress', () => {
        /* do something */
        this.props.search_reset_category();

        return true;
      });
    }
    
    componentWillUnmount() {
      this.backHandler.remove();
    }
    
    render(){
     /*...*/
    }
  }
Powered by Remix
|
Designed by szhshp
|
Copyright © szhshp 2022