Reputation: 21
Take a look at this navigation structure:
Tab bar:
-StackNavigatorA:
--Screen A1
--Screen A2
--Screen A3
--Screen A4
-StackNavigatorB:
--Screen B1
Upon changing the tab from StackA to StackB and returning to StackA I want to keep all the screens as they were, apart from ScreenA4.
So if a user is on ScreenA3, switches tab to StackB, and goes back to StackA I want to keep ScreenA3 open, the same thing with screen A2
But if a user is on ScreenA4, switches tab to StackB, and goes back to StackA I want to remove ScreenA4 and display ScreenA3
Sorry if my explanation is confusing
I tried using global NavigationRef and its state however I couldn't find a way to get the last active route's name on the Tab bar press
Upvotes: 0
Views: 108
Reputation: 1156
Check the events of BottomTabsNavigator https://reactnavigation.org/docs/bottom-tab-navigator#events
Upvotes: 0