'Navigate to first screen in bottom tab navigation in reat native

I have 2 screens in one Bottom stack navigator and 2 more screens in one of the bottom stack navigator screen.

Order of screens

  • Home Bottom Tab
    • Home Screen
    • Record Screen
  • About Bottom Tab
    • About screen

If I am on the record screen and I navigate to the about screen and by clicking the home bottom tab I will navigate back to the record screen but I want it to navigate me to the first screen in the home stack i.e home screen. How can I do that?

Bottom Tab Navigator

const HomeStackScreen = createBottomTabNavigator();

<HomeStackScreen.Navigator screenOptions={{ headerShown: false }}>
  <HomeStackScreen.Screen
    name={homeScreen}
    component={Home}
    user={props.user}
    options={{ headerShown: false }}
  />
  <HomeStackScreen.Screen
    name={aboutScreen}
    component={About}
    user={props.user}
    options={{ headerShown: false }}
  />
</HomeStackScreen.Navigator>

Stack Navigator

const HomeStack = createStackNavigator();

<HomeStack.Navigator screenOptions={{ headerShown: false }}>
  <HomeStack.Screen
    name={homeScreen}
    component={Home}
    user={props.user}
    options={{ headerShown: false }}
  />
  <HomeStack.Screen
    name={recordScreen}
    component={Record}
    user={props.user}
    options={{ headerShown: false }}
  />
</HomeStack.Navigator>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source