Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

186
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda