Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

183
Views
How do I change react-navigation/drawer item "onPress" behavior?

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.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!