Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reset navigation stack each time Tab Bar item is selected?

So, i need to reset navigation stack each time a tab is selected from the tab navigation. Right now it works like this:

User is on Tab A -> Opened New Screen (i.e. News) on Tab A -> Selected Tab B -> Selected Tab A and came back to last opened screen (News) instead of coming back to Tab A .

I need to change the last step and reset the opened screens each time user selects new Tab.

i know that there are few API items that i can use for it, like pop, popToRoot and resetTo but i have no idea how to use it correctly.

Can someone give me an example that i can use it?

Thanks in advance!

like image 342
Ziya Avatar asked Nov 18 '25 12:11

Ziya


1 Answers

Listen to BottomTabSelected event and call this.props.navigator.popToRoot.

like image 89
guy.gc Avatar answered Nov 21 '25 09:11

guy.gc