Ultraboost
Ultraboost

Reputation: 11

Navigating between Nested Navigators and handling the navigation stack

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}

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.

Upvotes: 0

Views: 1259

Answers (1)

NAZIR HUSSAIN
NAZIR HUSSAIN

Reputation: 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'}} });

Upvotes: 0

Related Questions