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

Function pop

packages/core/src/StateUtils.js:62–73  ·  view source on GitHub ↗

* Pops out a route from the navigation state. * Note that this moves the index to the position to where the last route in the * stack is at.

(state)

Source from the content-addressed store, hash-verified

60 * stack is at.
61 */
62 pop(state) {
63 if (state.index <= 0) {
64 // [Note]: Over-popping does not throw error. Instead, it will be no-op.
65 return state;
66 }
67 const routes = state.routes.slice(0, -1);
68 return {
69 ...state,
70 index: routes.length - 1,
71 routes,
72 };
73 },
74
75 /**
76 * Sets the focused route of the navigation state by index.

Callers 7

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

Calls

no outgoing calls

Tested by

no test coverage detected