Skip to content
This repository was archived by the owner on Mar 17, 2025. It is now read-only.
Discussion options

You must be logged in to vote

I use the underlying react navigation stuff to handle that. I have not seen a way to do this with expo-router.

https://reactnavigation.org/docs/navigation-actions/#reset

import { useRootNavigation } from "expo-router";
import { CommonActions } from "@react-navigation/native";
// ...
function MyComponent() {
// ...
  const navigation = useRootNavigation();
  async function goToRoute() {
    // Typescript indicates navigation can be undefined here, 
    // so we're implementing a graceful fallback in such cases.
    try {
      if (!navigation) throw new Error();
      navigation.dispatch(CommonActions.reset({
        index: 0,
        routes: [{
          // This is going to heavily rely o…

Replies: 4 comments 7 replies

Comment options

You must be logged in to vote
1 reply
@lsps9150414
Comment options

Comment options

You must be logged in to vote
3 replies
@wcastand
Comment options

@GibbyBox
Comment options

@wcastand
Comment options

Answer selected by lsps9150414
Comment options

You must be logged in to vote
1 reply
@mustafasenturk
Comment options

Comment options

You must be logged in to vote
2 replies
@wcastand
Comment options

@marcyannick1
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
7 participants