mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-04-28 12:25:21 +08:00
No need to have a conditional around slicing the routes array
This commit is contained in:
@@ -243,12 +243,9 @@ export default (routeConfigs, stackConfig = {}) => {
|
||||
if (state.index === lastRouteIndex && !action.params) {
|
||||
return state;
|
||||
}
|
||||
let routes = [...state.routes];
|
||||
|
||||
// If we are navigating backwards in the stack (via key) the other routes
|
||||
if (lastRouteIndex + 1 < routes.length) {
|
||||
routes = routes.slice(0, lastRouteIndex + 1);
|
||||
}
|
||||
// Remove the now unused routes at the tail of the routes array
|
||||
const routes = state.routes.slice(0, lastRouteIndex + 1);
|
||||
|
||||
// Apply params if provided, otherwise leave route identity intact
|
||||
if (action.params) {
|
||||
|
||||
Reference in New Issue
Block a user