UNPKG

one

Version:

One is a React framework for web, iOS, and Android apps.

71 lines (68 loc) • 2.37 kB
import { useEffect, useMemo } from "react"; import { useNavigation } from "@react-navigation/native"; import { NAVIGATOR_CONFIG } from "../../headless/children.mjs"; import { PLATFORM } from "../../utils/platform.mjs"; import { TOOLBAR_KIND, appendStackToolbarPropsToOptions, appendStackToolbarPropsToOptions as appendStackToolbarPropsToOptions2, isToolbarKind } from "./stackToolbarDescriptors.mjs"; import { BottomToolbarHost } from "./StackToolbarBottomHost.mjs"; import { jsx } from "react/jsx-runtime"; function mark(component, kind) { return Object.assign(component, { [NAVIGATOR_CONFIG]: true, [TOOLBAR_KIND]: kind }); } function StackToolbarComponent(props) { const placement = props.placement ?? "bottom"; if (placement === "bottom") { if (PLATFORM !== "ios") return null; return /* @__PURE__ */ jsx(BottomToolbarHost, { children: props.children }); } return /* @__PURE__ */ jsx(StackToolbarHeaderOptions, { props }); } mark(StackToolbarComponent, "toolbar"); function StackToolbarHeaderOptions({ props }) { const navigation = useNavigation(); const options = useMemo(() => appendStackToolbarPropsToOptions({}, props), [ props.children, props.placement, props.asChild ]); useEffect(() => { navigation.setOptions(options); }, [navigation, options]); return null; } function StackToolbarButton(_props) { return null; } mark(StackToolbarButton, "button"); function StackToolbarMenu(_props) { return null; } mark(StackToolbarMenu, "menu"); function StackToolbarMenuAction(_props) { return null; } mark(StackToolbarMenuAction, "menuAction"); function StackToolbarSpacer(_props) { return null; } mark(StackToolbarSpacer, "spacer"); function StackToolbarSearchBarSlot(_props) { return null; } mark(StackToolbarSearchBarSlot, "searchBarSlot"); function StackToolbarLabel(_props) { return null; } mark(StackToolbarLabel, "label"); function StackToolbarIcon(_props) { return null; } mark(StackToolbarIcon, "icon"); function StackToolbarBadge(_props) { return null; } mark(StackToolbarBadge, "badge"); export { StackToolbarBadge, StackToolbarButton, StackToolbarComponent, StackToolbarIcon, StackToolbarLabel, StackToolbarMenu, StackToolbarMenuAction, StackToolbarSearchBarSlot, StackToolbarSpacer, appendStackToolbarPropsToOptions2 as appendStackToolbarPropsToOptions, isToolbarKind }; //# sourceMappingURL=StackToolbar.mjs.map