import { RouterState, RouteState } from '../routeable'; /** * Utilities to perform atomic operation with navigate state and routes. * * ```javascript * const state1 = {key: 'screen 1'}; * const state2 = NavigationStateUtils.push(state1, {key: 'screen 2'}); * ``` */ declare const StateUtils: { /** * Gets a route by key. If the route isn't found, returns `null`. */ get(state: RouterState, key: string): RouteState | null; /** * Returns the first index at which a given route's key can be found in the * routes of the navigation state: RouterState, or -1 if it is not present. */ indexOf(state: RouterState, key: string): number; /** * Returns `true` at which a given route's key can be found in the * routes of the navigation state. */ has(state: RouterState, key: string): boolean; /** * 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. */ push(state: RouterState, route: RouteState): { index: number; routes: RouteState[]; key: string; routeName: string; params: any; componentName: string; }; /** * 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. */ pop(state: RouterState): RouterState; /** * Sets the focused route of the navigation state by index. */ jumpToIndex(state: RouterState, index: number): RouterState; /** * Sets the focused route of the navigation state by key. */ jumpTo(state: RouterState, key: string): RouterState; /** * Sets the focused route to the previous route. */ back(state: RouterState): RouterState; /** * Sets the focused route to the next route. */ forward(state: RouterState): RouterState; /** * Replace a route by a key. * Note that this moves the index to the position to where the new route in the * stack is at and updates the routes array accordingly. */ replaceAndPrune(state: RouterState, key: string, route: any): { routes: RouteState[]; index: number; key: string; routeName: string; params: any; componentName: string; }; /** * Replace a route by a key. * Note that this moves the index to the position to where the new route in the * stack is at. Does not prune the routes. * If preserveIndex is true then replacing the route does not cause the index * to change to the index of that route. */ replaceAt(state: RouterState, key: string, route: RouteState, preserveIndex?: boolean): RouterState; /** * 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. */ replaceAtIndex(state: RouterState, index: number, route: RouteState): RouterState; /** * Resets all routes. * Note that this moves the index to the position to where the last route in the * stack is at if the param `index` isn't provided. */ reset(state: RouterState, routes: RouteState[], index: number): RouterState; }; export default StateUtils;