title: How to do conditional routing using react-navigation?
body: <p>I am using react-navigation for the routing of my react-native application. I am using switch navigator for authentication flow. After the user logs in there are five bottom tabs. I have nested stack navigator inside bottom tab bar navigator inside main stack navigator. In one of the tabs, I have a screen for 'username' registration and then route to the community screen. With my current route, if the user creates the 'username', they will be redirected to the second screen, but if they press back, they are redirected to the sign-up screen again. How can I manage the routing?</p>
  
  <pre><code>const AppStack = createStackNavigator({
    AppTabsScreen: {
      screen: createBottomTabNavigator ({
        HomeTab: { 
          screen: createStackNavigator ({
            HomeScreen: { screen: Home },
            ArticleScreen: { screen: Article },
            AllArticleScreen: { screen: AllArticle },
            WebViewScreen: { screen: WebScreen },
            ShareScreen: { screen: ShareScreen },
            UsernameSignUpScreen: UsernameSignUp,
         },
         {
          initialRouteName: 'HomeScreen',
        })
        },
        LocationTab: { 
          screen: createStackNavigator({
            UsernameSignUpScreen: UsernameSignUp,
            Location: NearbyLocation,
            WebViewScreen: { screen: WebScreen },
            ShareScreen: { screen: ShareScreen },
            CommunityPageScreen: { screen: CommunityPage },
          },
          {
            initialRouteName: 'UsernameSignUpScreen',
          })
        },
        AssistantTab: { 
          screen: createStackNavigator ({
            AssistantScreen: { screen: Assistant },
            BrandInfoScreen: { screen: BrandInfo },
            WebViewScreen: { screen: WebScreen },
            ShareScreen: { screen: ShareScreen },
            FilterBrandScreen: { screen: FilterBrandComponent },
            SearchScreen: { screen: SearchProducts },
          },
          {
            initialRouteName: 'AssistantScreen',
          }) 
        },
        CTab: {
          screen: createStackNavigator({ 
            CScreen: { screen: CScreen },
            SearchScreen: { screen: SearchProducts },
            BrandContainerScreen: { screen: BrandContainer },
            BrandInfoScreen: { screen: BrandInfo },
            AllProductsScreen: { screen: AllProducts },
            },
            {
              initialRouteName: 'CScreen',
        }),
      },
        ProfileTab: { 
          screen: createStackNavigator({
            ProfileScreen: { screen: Profile },
            ShareScreen: { screen: ShareScreen },
            WebViewScreen: { screen: WebScreen },
            ArticleScreen: { screen: Article },
            AllArticleScreen: { screen: AllArticle },
            UserExperienceScreen: { screen: UserExperience },
          },
            {
              initialRouteName: 'ProfileScreen',
            }),
        }
      }, {
        initialRouteName: 'HomeTab',
        order: ['HomeTab', 'LocationTab', 'AssistantTab', 'CTab', 'ProfileTab'],
        animationEnabled: true,
        defaultNavigationOptions: ({ navigation }) =&gt; ({
          tabBarLabel: () =&gt; {
            const { routeName } = navigation.state;
            let tLabel;
            if (routeName === 'HomeTab') {
              tLabel = 'Home';
              return &lt;Text style={{ textAlign: 'center', fontSize: wp(2.7), fontFamily:'OpenSans-SemiBold',}}&gt;{tLabel}&lt;/Text&gt;;
            } else if (routeName === 'LocationTab') {
              tLabel = 'Community';
              return &lt;Text style={{ textAlign: 'center', fontSize: wp(2.7), fontFamily:'OpenSans-SemiBold',}}&gt;{tLabel}&lt;/Text&gt;;
            } else if (routeName === 'CTab') {
              tLabel = 'Explore';
              return &lt;Text style={{ textAlign: 'center', fontSize: wp(2.7), fontFamily:'OpenSans-SemiBold',}}&gt;{tLabel}&lt;/Text&gt;;
            } else if (routeName === 'AssistantTab') {
              tLabel = 'Risk';
              return &lt;Text style={{ textAlign: 'center', fontSize: wp(2.7), fontFamily: 'OpenSans-SemiBold', }}&gt;{tLabel}&lt;/Text&gt;;
            } else if (routeName === 'ProfileTab') {
              tLabel = 'Profile';
              return &lt;Text style={{ textAlign: 'center', fontSize: wp(2.7), fontFamily:'OpenSans-SemiBold',}}&gt;{tLabel}&lt;/Text&gt;;
            }
          },
          tabBarIcon: ({ tintColor }) =&gt; {
            const { routeName } = navigation.state;
            let iconName;
            if (routeName === 'HomeTab') {
              iconName = `home`;
              return &lt;IconComponent name={iconName} size={wp(8)} color={tintColor} /&gt;
            } else if (routeName === 'LocationTab') {
              iconName = `globe`;
              return &lt;IconComponent name={iconName} size={wp(8)} color={tintColor} /&gt;
            } else if (routeName === 'AssistantTab') {
              iconName = `Logo`;
              return &lt;IconComponent name={iconName} size={wp(8)} color={tintColor} /&gt;
            } else if (routeName === 'CTab') {
              iconName = `Library`;
              return &lt;IconComponent name={iconName} size={wp(8)} color={tintColor} /&gt;
            } else if (routeName === 'ProfileTab') {
              iconName = `user`;
              return &lt;IconComponent name={iconName} size={wp(8)} color={tintColor} /&gt;
            }
            //return &lt;IconComponent name={iconName} size={wp(8)} color={tintColor} /&gt;;
          },
        }),
        tabBarOptions: {
            activeTintColor: '#000',
            inactiveTintColor: '#7f8c8d',
            activeBackgroundColor: '#FAFAFA',
            inactiveBackgroundColor: '#FAFAFA',
            style: {height: hp(8.5)},
            showLabel: true,
            showIcon: true,
            keyboardHidesTabBar: true
        }
      })
    }
  },{
      initialRouteName: 'AppTabsScreen',
      headerMode: 'none',
      navigationOptions: {
        header: null
      }
  })
  </code></pre>
  
  <p>I expect that the routing in the second tab ie. LocationTab when clicked should rediect to the 'CommunityPageScreen' inside LocationTab if the user has username, if not then the route should start with 'UsernameSignUpScreen'.</p>