Closed jbkuczma closed 6 years ago
The following works as intended BUT there is a bug
tabBarOnPress: ({ scene, jumpToIndex }) => {
console.log('onPress:', scene);
if (scene.route.index !== 0) {
navigation.popToTop()
} else {
jumpToIndex(scene.index)
}
}
BUG: standings -> team -> games -> game -> scores tab -> game -> tap scores tab and then standings (can't view standings tab)
side effect noted in comment:
placing this issue on hold
and creating a new issue for the problem described above
In other apps when you tap on a tab button it will perform a function (ex: Instagram: search for a user, click their profile, click search tab button takes you back to the initial search screen).
When you click the tab button while in a nested scene for that tab, you should go back to the root scene (ex: Scores screen -> game -> boxscore -> tap scores tab button -> back to Scores screen).
Something along the lines of the following would go in
navigationOptions({...})
of the tab navigator:tabBarOnPress: (scene, jumpToIndex) => { console.log('onPress:', scene) }
source: https://reactnavigation.org/docs/tab-navigator.html#tabbaronpress