UNPKG

one

Version:

One is a new React Framework that makes Vite serve both native and web.

28 lines (27 loc) 1.15 kB
import { TabRouter as RNTabRouter } from "@react-navigation/native"; function ExpoTabRouter(options) { const rnTabRouter = RNTabRouter(options); return { ...rnTabRouter, getStateForAction(state, action, options2) { if (action.type !== "JUMP_TO") return rnTabRouter.getStateForAction(state, action, options2); const route = state.routes.find((route2) => route2.name === action.payload.name); if (!route) return null; let shouldReset = !state.history.some((item) => item.key === route?.key) && !route.state; return !shouldReset && "resetOnFocus" in action.payload && action.payload.resetOnFocus && (shouldReset = state.routes[state.index].key !== route.key), shouldReset ? (options2.routeParamList[route.name] = { ...options2.routeParamList[route.name] }, state = { ...state, routes: state.routes.map((r) => r.key !== route.key ? r : { ...r, state: void 0 }) }, rnTabRouter.getStateForAction(state, action, options2)) : rnTabRouter.getStateForRouteFocus(state, route.key); } }; } export { ExpoTabRouter }; //# sourceMappingURL=TabRouter.js.map