UNPKG

one

Version:

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

65 lines (63 loc) 2.52 kB
"use strict"; "use client"; 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 StackScreen_exports = {}; __export(StackScreen_exports, { StackScreen: () => StackScreen, appendScreenStackPropsToOptions: () => appendScreenStackPropsToOptions }); module.exports = __toCommonJS(StackScreen_exports); var import_jsx_runtime = require("react/jsx-runtime"), import_react = require("react"), import_StackHeaderComponent = require("./StackHeaderComponent.native.js"), import_Screen = require("../../views/Screen.native.js"); function StackScreen(param) { var { children, options, ...rest } = param, updatedOptions = (0, import_react.useMemo)(function () { return appendScreenStackPropsToOptions(options ?? {}, { children }); }, [options, children]); return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_Screen.Screen, { ...rest, options: updatedOptions }); } function appendScreenStackPropsToOptions(options, props) { var updatedOptions = { ...options, ...props.options }; function appendChildOptions(child, options2) { if (child.type === import_StackHeaderComponent.StackHeaderComponent) return (0, import_StackHeaderComponent.appendStackHeaderPropsToOptions)(options2, child.props); var _child_type_name; return console.warn(`Warning: Unknown child element passed to Stack.Screen: ${(_child_type_name = child.type.name) !== null && _child_type_name !== void 0 ? _child_type_name : child.type}`), options2; } return import_react.Children.forEach(props.children, function (child) { /* @__PURE__ */(0, import_react.isValidElement)(child) && (updatedOptions = appendChildOptions(child, updatedOptions)); }), updatedOptions; } //# sourceMappingURL=StackScreen.native.js.map