react-native-navigators
Advanced tools
Comparing version 0.0.1-beta.21 to 0.0.1-beta.22
@@ -10,2 +10,3 @@ import { PureComponent } from 'react'; | ||
replacingRouteKeys: string[]; | ||
dismissingRouteKeys: string[]; | ||
descriptors: NativeNavigationDescriptorMap; | ||
@@ -12,0 +13,0 @@ } |
import React, { PureComponent } from 'react'; | ||
import { StackActions } from 'react-navigation'; | ||
import { StackActions, NavigationActions } from 'react-navigation'; | ||
import { NativeNavigatorTransitions, NativeNavigatorModes } from './types'; | ||
@@ -15,2 +15,3 @@ import NativeStackNavigator from './NativeStackNavigator'; | ||
replacingRouteKeys: [], | ||
dismissingRouteKeys: [], | ||
descriptors: {} | ||
@@ -49,9 +50,10 @@ }; | ||
this.handleDismissRoute = (route) => { | ||
this.props.navigation.dispatch({ | ||
type: NavigationActions.BACK, | ||
key: route.key, | ||
immediate: true | ||
}); | ||
this.setState(state => ({ | ||
routes: state.routes.filter(r => r.key !== route.key), | ||
openingRouteKeys: state.openingRouteKeys.filter(key => key !== route.key), | ||
closingRouteKeys: state.closingRouteKeys.filter(key => key !== route.key) | ||
}), () => { | ||
this.props.navigation.goBack(route.key); | ||
}); | ||
dismissingRouteKeys: [...state.dismissingRouteKeys, route.key] | ||
})); | ||
}; | ||
@@ -77,3 +79,3 @@ } | ||
// Now we need to determine which routes were added and removed | ||
let { openingRouteKeys, closingRouteKeys, replacingRouteKeys } = state; | ||
let { openingRouteKeys, closingRouteKeys, replacingRouteKeys, dismissingRouteKeys } = state; | ||
const { previousRoutes } = state; | ||
@@ -146,7 +148,8 @@ const previousFocusedRoute = previousRoutes[previousRoutes.length - 1]; | ||
return { | ||
routes, | ||
routes: routes.filter(({ key }) => !dismissingRouteKeys.includes(key)), | ||
previousRoutes: navigation.state.routes, | ||
openingRouteKeys, | ||
closingRouteKeys, | ||
replacingRouteKeys, | ||
openingRouteKeys: openingRouteKeys.filter(key => !dismissingRouteKeys.includes(key)), | ||
closingRouteKeys: closingRouteKeys.filter(key => !dismissingRouteKeys.includes(key)), | ||
replacingRouteKeys: replacingRouteKeys.filter(key => !dismissingRouteKeys.includes(key)), | ||
dismissingRouteKeys: [], | ||
descriptors | ||
@@ -153,0 +156,0 @@ }; |
{ | ||
"version": "0.0.1-beta.21", | ||
"version": "0.0.1-beta.22", | ||
"name": "react-native-navigators", | ||
@@ -4,0 +4,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
207748
1336