I have a stack navigator nested inside a drawer navigator.
<HomeDrawerNavigator.Screen
name='Restaurants'
component={RestaurantsStackNavigator}
/>
<HomeDrawerNavigator.Screen
name='Settings'
component={SettingsNavigator}
/>
and
//RestaurantsStackNavigator
<RestaurantsNavigator.Screen
name='Menu'
component={MenuScreen}
/>
<RestaurantsNavigator.Screen
name='MenuProductsDetail'
component={MenuProductsDetailScreen}
/>
I want that when pressing the "Restaurants" button in the drawer to navigate to the first screen of the stack MenuScreen, even if the Restaurants item is already selected in the drawer.
Example: In the drawer, the Restaurants item is selected, and I'm in the MenuProductsDetailScreen. I want that when pressing the "Restaurants" button inside the drawer (that is already focused), to navigate to the MenuScreen.
I can use the StackActions.replace() function, but I don't know how to change the default behavior when pressing on a drawer item. Also any other workarounds are welcomed.