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

Function replaceAtIndex

packages/core/src/StateUtils.js:153–173  ·  view source on GitHub ↗

* Replace a route by a index. * Note that this moves the index to the position to where the new route in the * stack is at.

(state, index, route)

Source from the content-addressed store, hash-verified

151 * stack is at.
152 */
153 replaceAtIndex(state, index, route) {
154 invariant(
155 !!state.routes[index],
156 'invalid index %s for replacing route %s',
157 index,
158 route.key
159 );
160
161 if (state.routes[index] === route && index === state.index) {
162 return state;
163 }
164
165 const routes = state.routes.slice();
166 routes[index] = route;
167
168 return {
169 ...state,
170 index,
171 routes,
172 };
173 },
174
175 /**
176 * Resets all routes.

Callers

nothing calls this directly

Calls 1

invariantFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…