Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
const path = Constants.getVisiblePath()
// We determine if we're at the root if we're at the root of our navigation hierarchy, which is slightly different if you're logged in or out
if (path[0].routeName === 'loggedIn') {
if (path[1].routeName === 'Main') {
if (path.length === 3) {
return false
}
}
} else {
if (path.length === 2) {
return false
}
}
nav.dispatch(StackActions.pop({}))
return true
}
_removeScene = route => {
this.props.navigation.dispatch(StackActions.pop({ key: route.key }));
};
if (action.payload.replace) {
return [StackActions.replace({params, routeName})]
}
return [StackActions.push({params, routeName})]
}
case RouteTreeGen.switchTab: {
return [NavigationActions.navigate({routeName: action.payload.tab})]
}
case RouteTreeGen.switchLoggedIn: {
return [NavigationActions.navigate({routeName: action.payload.loggedIn ? 'loggedIn' : 'loggedOut'})]
}
case RouteTreeGen.clearModals: {
const numModals = getNumModals(navigation)
return numModals ? [StackActions.pop({n: numModals})] : []
}
case RouteTreeGen.navigateUp:
return [NavigationActions.back({key: action.payload.fromKey})]
case RouteTreeGen.navUpToScreen: {
const fullPath = Constants._getFullRouteForNavigator(navigation.state)
const popActions: Array = []
const isInStack = fullPath.reverse().some(r => {
if (r.routeName === action.payload.routeName) {
return true
}
popActions.push(StackActions.pop({}))
return false
})
return isInStack ? popActions : []
}
case RouteTreeGen.resetStack: {
const isInStack = fullPath.reverse().some(r => {
if (r.routeName === action.payload.routeName) {
return true
}
popActions.push(StackActions.pop({}))
return false
})
return isInStack ? popActions : []