title: How to close a React Navigation modal with multiple screens in it
body: <p>I'm using <a href="https://reactnavigation.org/" rel="noreferrer">https://reactnavigation.org/</a> for navigation in a React Native app with a tab navigator as the main stack and a modal with two screens in it (for logging in and configuring the app).</p>
  
  <p>I can't for the life of me figure out how to close the modal from the second screen (<code>SelectItems</code>).  From the first screen in the modal I can close it with <code>navigation.goBack()</code>.</p>
  
  <p>Both modal screens need a close button.  Is there a way to just return back to whatever tab the user was on? </p>
  
  <p>Thanks in advance for any help.</p>
  
  <pre class="lang-js prettyprint-override"><code>const Tabs = TabNavigator(
    {
      Search: { screen: Search },
      Settings: { screen: Settings }
    }
  );
  
  // modal with two screens
  const Setup = StackNavigator(
    {
      Login: {
        screen: Login
      },
      SelectItems: {
        screen: SelectItems
      }
    },
    {
      initialRouteName: 'Login'
    }
  );
  
  const RootStack = StackNavigator(
    {
      Main: {
        screen: Tabs
      },
      Setup: {
        screen: Setup
      }
    },
    {
      mode: 'modal',
      headerMode: 'none'
    }
  );
  </code></pre>