mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-05-15 07:57:09 +08:00
fix: drop custom history logic for isFirstRouteInParent (#52)
As the naming suggests, this checks if route is the first one in parent. So probably doesn't make sense to check history.
This commit is contained in:
@@ -60,13 +60,8 @@ function getChildNavigation(navigation, childKey, getCurrentParentNavigation) {
|
||||
const parentNavigation = getCurrentParentNavigation();
|
||||
|
||||
if (parentNavigation) {
|
||||
isFirstRouteInParent = parentNavigation.routeKeyHistory
|
||||
? // For navigators such as switch/tab navigators, history is separate from routes
|
||||
parentNavigation.routeKeyHistory.length
|
||||
? parentNavigation.routeKeyHistory.indexOf(childKey) === 0
|
||||
: true
|
||||
: // For stack navigator, list of routes is the same as the history
|
||||
parentNavigation.state.routes.indexOf(childRoute) === 0;
|
||||
isFirstRouteInParent =
|
||||
parentNavigation.state.routes.indexOf(childRoute) === 0;
|
||||
}
|
||||
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user