title: BackHandler in React Native isn't working
body: <pre><code>const RootNav = createStackNavigator(
    {
      Splash: {
          screen:Splash
      },
      BeforeLogin: {
          screen:BeforeLogin
      },    
      Signin: {
          screen:Signin,
      },
      Signup: {
          screen:Signup
      },
      Tabs: {
          screen:TabHolder,
      },
      ForgotPassword: {
          screen:ForgotPassword
      },
    } );
  </code></pre>
  
  <p>Below is the <code>BackHandler</code> I used in my <code>BeforeLogin</code> screen.</p>
  
  <pre><code>  componentWillMount() { 
      BackHandler.addEventListener('hardwareBackPress', this.handleBackButton); 
    } 
  
    componentWillUnmount() { 
      BackHandler.removeEventListener('hardwareBackPress', this.handleBackButton); 
    }
  
    handleBackButton = () =&gt; { 
      BackHandler.exitApp(); 
    }
  </code></pre>
  
  <p>Below is the <code>BackHandler</code> I have used in my <code>Signin</code> screen and <code>Signup</code> screen.  </p>
  
  <pre><code>  componentDidMount() {
      BackHandler.addEventListener('hardwareBackPress',() =&gt; {   
  
        this.props.navigation.navigate('BeforeLogin');
        return true;
  
      });
    } 
  </code></pre>
  
  <p>My <code>BeforeLogin</code> screen has 2 buttons. Signin and Signup which navigates me to <code>Signin</code> and <code>Signup</code> screen.</p>
  
  <p>Now, there are 2 scenarios which I'm facing.</p>
  
  <p><strong>Scenario 1:</strong> I am on <code>BeforeLogin</code> screen and I don't navigate to either <code>Signin</code> or <code>Signup</code> screen. And now, when I press my android back buttton, it closes the app. And that's what I want, to be able to close the app when user presses back button from <code>BeforeLogin</code> screen.</p>
  
  <p><strong>Scenaraio 2:</strong> I am on <code>BeforeLogin</code> screen and I navigate to either <code>Signin</code> or <code>Signup</code> screen. And now when I go back to <code>BeforeLogin</code> screen and then press android back button, the app isn't closing now.</p>
  
  <p>How can I solve my <strong>Scenaraio 2:</strong> ? Please help.</p>