react-native-navigators
Advanced tools
Comparing version 0.3.0-31 to 0.3.0-32
@@ -11,4 +11,6 @@ import { StackRouter, NavigationActions } from 'react-navigation'; | ||
// 如果在 SplitRouter 中对 primary route 的子路由做 NAVIGATE 导航会导致右侧路由退出,交互不符合预期 | ||
if ((newState === null || newState === void 0 ? void 0 : newState.index) === 0 && state.index > 0) { | ||
return Object.assign(Object.assign({}, newState), { index: state.index, routes: [...newState.routes, ...state.routes.slice(1)] }); | ||
if (newState && newState.index > -1 && newState.index < state.index) { | ||
const newRoutes = state.routes.slice(); | ||
newRoutes.splice(newState.index, 1, newState.routes[newState.index]); | ||
return Object.assign(Object.assign({}, newState), { index: state.index, routes: newRoutes }); | ||
} | ||
@@ -23,3 +25,3 @@ else { | ||
// 如果 SplitRouter 中对 primary route 的子路由做 BACK 导航会导致右侧路由退出,交互不符合预期 | ||
if ((newState === null || newState === void 0 ? void 0 : newState.index) === 0 && newState.routes.length > 1) { | ||
if (newState && newState.index < newState.routes.length - 1) { | ||
return Object.assign(Object.assign({}, newState), { index: newState.routes.length - 1 }); | ||
@@ -26,0 +28,0 @@ } |
{ | ||
"version": "0.3.0-31", | ||
"version": "0.3.0-32", | ||
"name": "react-native-navigators", | ||
@@ -4,0 +4,0 @@ "repository": { |
@@ -33,7 +33,10 @@ import { | ||
// 如果在 SplitRouter 中对 primary route 的子路由做 NAVIGATE 导航会导致右侧路由退出,交互不符合预期 | ||
if (newState?.index === 0 && state.index > 0) { | ||
if (newState && newState.index > -1 && newState.index < state.index) { | ||
const newRoutes = state.routes.slice(); | ||
newRoutes.splice(newState.index, 1, newState.routes[newState.index]); | ||
return { | ||
...newState, | ||
index: state.index, | ||
routes: [...newState.routes, ...state.routes.slice(1)] | ||
routes: newRoutes | ||
}; | ||
@@ -51,3 +54,3 @@ } else { | ||
// 如果 SplitRouter 中对 primary route 的子路由做 BACK 导航会导致右侧路由退出,交互不符合预期 | ||
if (newState?.index === 0 && newState.routes.length > 1) { | ||
if (newState && newState.index < newState.routes.length - 1) { | ||
return { | ||
@@ -54,0 +57,0 @@ ...newState, |
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
389947
3927