title: React native hardware back button is not working
body: <p>I'm working on react native Android and face problem for hardware back button my react native version is 0.44.2 and I'm using BackHandler below is my code for the back button:</p>
  
  <pre><code>BackHandler.addEventListener("hardwareBackPress", () =&gt; {
    if (this.navigator &amp;&amp; this.navigator.getCurrentRoutes().length &gt; 1){this.navigator.pop()
  return true // do not exit app
  } else {
  return false // exit app
  }})
  </code></pre>
  
  <p>I got the following error:</p>
  
  <p><a href="https://i.stack.imgur.com/Xe5JQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Xe5JQl.png" alt="Error_for_back_button"></a></p>