MCPcopy Index your code
hub / github.com/react-navigation/react-navigation / push

Function push

packages/core/src/StateUtils.js:40–55  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

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.

Callers 8

renderMethod · 0.50
renderMethod · 0.50
renderMethod · 0.50
renderMethod · 0.50
renderMethod · 0.50
renderMethod · 0.50
renderMethod · 0.50
renderMethod · 0.50

Calls 1

invariantFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…