UNPKG

one

Version:

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

101 lines (99 loc) 3.38 kB
"use strict"; 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: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__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: true }), mod); var Tabs_exports = {}; __export(Tabs_exports, { Tabs: () => Tabs, default: () => Tabs_default }); module.exports = __toCommonJS(Tabs_exports); var import_jsx_runtime = require("react/jsx-runtime"); var import_bottom_tabs = require("@react-navigation/bottom-tabs"); var import_react_native = require("react-native"); var import_Link = require("../link/Link.native.js"); var import_Protected = require("../views/Protected.native.js"); var import_withLayoutContext = require("./withLayoutContext.native.js"); var TabBar = function (param) { var { state, ...restProps } = param; var filteredRoutes = state.routes.filter(function (r) { return r.name !== "+not-found" && !r.name.startsWith("_sitemap"); }); return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_bottom_tabs.BottomTabBar, { state: { ...state, routes: filteredRoutes }, ...restProps }); }; var BottomTabNavigator = (0, import_bottom_tabs.createBottomTabNavigator)().Navigator; var Tabs = Object.assign((0, import_withLayoutContext.withLayoutContext)(BottomTabNavigator, function (screens) { return screens.map(function (screen) { var _screen_options; if (typeof screen.options !== "function" && ((_screen_options = screen.options) === null || _screen_options === void 0 ? void 0 : _screen_options.href) !== void 0) { var { href, ...options } = screen.options; if (options.tabBarButton) { throw new Error("Cannot use `href` and `tabBarButton` together."); } return { ...screen, options: { ...options, tabBarButton: function (props) { if (href == null) { return null; } var children = import_react_native.Platform.OS === "web" ? props.children : /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_react_native.Pressable, { children: props.children }); return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_Link.Link, { ...props, style: [{ display: "flex" }, props.style], href, asChild: import_react_native.Platform.OS !== "web", // biome-ignore lint/correctness/noChildrenProp: children prop needed for asChild pattern children }); } } }; } return screen; }); }, { props: { tabBar: TabBar } }), { Protected: import_Protected.Protected }); var Tabs_default = Tabs; //# sourceMappingURL=Tabs.native.js.map