* Pushes a new route into the navigation state. * Note that this moves the index to the position to where the last route in the * stack is at.
(state, route)
| 38 | * stack is at. |
| 39 | */ |
| 40 | push(state, route) { |
| 41 | invariant( |
| 42 | StateUtils.indexOf(state, route.key) === -1, |
| 43 | 'should not push route with duplicated key %s', |
| 44 | route.key |
| 45 | ); |
| 46 | |
| 47 | const routes = state.routes.slice(); |
| 48 | routes.push(route); |
| 49 | |
| 50 | return { |
| 51 | ...state, |
| 52 | index: routes.length - 1, |
| 53 | routes, |
| 54 | }; |
| 55 | }, |
| 56 | |
| 57 | /** |
| 58 | * Pops out a route from the navigation state. |
no test coverage detected
searching dependent graphs…