react-navigation / react-navigation/react-navigation
Pushing a screen from outside of bottom tab navigation opens the screen in previous active bottom tab.
Nessuno ha ancora preso questa issue.
- Lingua principale
- TypeScript
- Stelle
- 24.5k
- Fork
- 5.1k
- Merge medio
- 1g 5h
- PR unite (30g)
- 18
Descrizione
Current behavior
My root stack
<Stack.Navigator>
<Stack.Screen
name="BottomTabNavigation"
component={BottomTabNavigation}
/>
<Stack.Screen
name={'ScreenWithoutTab'}
key={'ScreenWithoutTab'}
component={ScreenWithoutTab}
/>
</Stack.Navigator>
My BottomTab
<Tab.Navigator
initialRouteName={'Home'}>
<Tab.Screen
name="Home"
key={'Home'}
component={HomeStack}
/>
<Tab.Screen
name="Settings"
key={'Settings'}
component={SettingsStack}
/>
</Tab.Navigator>
HomeStack
<Stack.Navigator
initialRouteName={'HomeScreen'}>
<Stack.Screen name="HomeScreen" key={'HomeScreen'} component={Home} />
<Stack.Screen name="TestScreen" key={'TestScreen'} component={Test} />
</Stack.Navigator>
SettingsStack
<Stack.Navigator
initialRouteName={'SettingsScreen'}>
<Stack.Screen name="SettingsScreen" key={'SettingsScreen'} component={Settings} />
<Stack.Screen name="TestScreen" key={'TestScreen'} component={Test} />
</Stack.Navigator>
Problematic Scenario
- I open the app and the bottom tab navigation appears with initial tab HOME
- I switch to Settings Tab
- I switch to Home Tab
- I press on a button on Home Screen to open the screen ScreenWithoutTab
- In ScreenWithoutTab screen, i press a button which calls following functions
navigation.push('TestScreen')
navigation.goBack()
- The screen opens at Settings Tab. But my latest active tab was Home as you can see at Step 3.
If i dont do the Step 2., everything works as expected the TestScreen opens at Home tab
Expected behavior
If I open a screen from the stack which is above bottom tab navigation and when a screen (which is nested in bottom tab) is pushed from that screen, the current tab should try to open the screen not previous selected tab.
Reproduction
Steps to reproduce described above.
Platform
- Android
- iOS
- Web
- Windows
- MacOS
Packages
- @react-navigation/bottom-tabs
- @react-navigation/drawer
- @react-navigation/material-bottom-tabs
- @react-navigation/material-top-tabs
- @react-navigation/stack
- @react-navigation/native-stack
Environment
- [] I've removed the packages that I don't use
| package | version |
|---|---|
| @react-navigation/native | 6.0.8 |
| @react-navigation/stack | 6.1.1 |
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia con la configurazione annidata di BottomTabNavigation, HomeStack, SettingsStack e root Stack.Navigator descritta nell’issue, quindi riproduci la sequenza passando da Settings a Home prima di chiamare navigation.push('TestScreen') e navigation.goBack(). Il lavoro è completato quando TestScreen si apre nell’ultima scheda Home attiva invece che nella scheda Settings selezionata in precedenza su Android e iOS.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- react, react-native
- Ambito
- mobile-dev
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100