1

I want to navigate from one tab to a nested screen inside another tab. How would I handle navigating from Tab 2 (search screen) to a nested screen in Tab 1? I have nested screens using different parameters, and I use navigation.push() to go through different screens with different params. Is there a way to go from Tab 2 to Screen with Params: {id: c} while also being able to go back to the screen with params: {id: b} and click the tab icon and go back to the home page of the tab navigator (Tab 1)?

Tab 1 Screen with Params: {id: null}

  • Screen with Params: {id: a}

    • Screen with Params: {id: b}

      • Screen with Params: {id: c}

Tab 2 Search Screen

Currently, when I navigate from Tab 2 to a screen in Tab 1 with params: {id: c}, clicking the tab icon to reset the stack navigator does nothing and I get a "The action 'GO_BACK' was not handled by the navigator" error when using a back button on the screen.

1
  • Please provide enough code so others can better understand or reproduce the problem. Commented Apr 18, 2023 at 2:38

1 Answer 1

1

when you need to navigate to a screen in different tab try using this

 navigation.navigate("Tab1", { screen: "ScreenName" });

or do this if you want to pass params to the screen

 navigation.navigate("Tab", { screen: {name:"ScreenName", params:{id:'my-id'}} });
Sign up to request clarification or add additional context in comments.

1 Comment

On the second example with params, use the actualy syntax: onPress={() => props.navigation.navigate("Veiculos", {screen: "CadastroVeiculo", params:{veiculo: {}, type: 'new'}}) } without name in object, from reactnavigation.org/docs/nesting-navigators/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.