one
Version:
One is a new React Framework that makes Vite serve both native and web.
58 lines (56 loc) • 2.26 kB
JavaScript
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all) __defProp(target, name, {
get: all[name],
enumerable: !0
});
},
__copyProps = (to, from, except, desc) => {
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
get: () => from[key],
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
});
return to;
};
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
value: !0
}), mod);
var TabRouter_exports = {};
__export(TabRouter_exports, {
ExpoTabRouter: () => ExpoTabRouter
});
module.exports = __toCommonJS(TabRouter_exports);
var import_native = require("@react-navigation/native");
function ExpoTabRouter(options) {
var rnTabRouter = (0, import_native.TabRouter)(options),
router = {
...rnTabRouter,
getStateForAction(state, action, options2) {
if (action.type !== "JUMP_TO") return rnTabRouter.getStateForAction(state, action, options2);
var route = state.routes.find(function (route2) {
return route2.name === action.payload.name;
});
if (!route) return null;
var shouldReset = !state.history.some(function (item) {
return 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(function (r) {
return r.key !== route.key ? r : {
...r,
state: void 0
};
})
}, rnTabRouter.getStateForAction(state, action, options2)) : rnTabRouter.getStateForRouteFocus(state, route.key);
}
};
return router;
}
//# sourceMappingURL=TabRouter.native.js.map