title: React Native WebView handling android hardware button
body: <p>I have an app (Webview exactly) and I'm trying to handle the Android hardware button to return from the second page for example to the first one. My problem now is the button won't close the app anymore, and I don't know what should I do. Here is my code:</p>
  
  <pre><code>export default class App extends Component {
    constructor(props) {
    super(props)
      this.state={
  
       };
  
  this.handleBackButtonClick = this.handleBackButtonClick.bind(this);
  }
  
  componentWillMount() {
  BackHandler.addEventListener('hardwareBackPress',this.handleBackButtonClick);
  }
  componentWillUnmount() {    BackHandler.removeEventListener('hardwareBackPress',this.handleBackButtonClick);
  }
  
  onNavigationStateChange(navState){
    console.log(JSON.stringify(navState));
    canGoBack = navState.url == initialUrl &amp;&amp; !navState.loading
  }
  
  
  handleBackButtonClick() {
       this.refs[WEBVIEW_REF].goBack();
       return true;
  } 
  </code></pre>