mirror of
https://github.com/status-im/react-navigation.git
synced 2025-02-24 00:58:20 +00:00
Fix issue with StackRouter popToTop (#3451)
Previously the state was getting squashed, in this case it would destroy the routeName of the state, which was a route for the parent navigator, who could no longer render properly.
This commit is contained in:
parent
e97d41cccf
commit
43a1c5ddbd
@ -27,6 +27,7 @@ class MyNavScreen extends React.Component<MyNavScreenProps> {
|
||||
onPress={() => navigation.navigate('Profile', { name: 'Jane' })}
|
||||
title="Go to a profile screen"
|
||||
/>
|
||||
<Button onPress={() => navigation.popToTop()} title="Pop to top" />
|
||||
<Button
|
||||
onPress={() => navigation.navigate('Photos', { name: 'Jane' })}
|
||||
title="Go to a photos screen"
|
||||
|
@ -175,6 +175,7 @@ export default (routeConfigs, stackConfig = {}) => {
|
||||
if (action.type === NavigationActions.POP_TO_TOP) {
|
||||
if (state.index !== 0) {
|
||||
return {
|
||||
...state,
|
||||
isTransitioning: action.immediate !== true,
|
||||
index: 0,
|
||||
routes: [state.routes[0]],
|
||||
|
Loading…
x
Reference in New Issue
Block a user