one
Version:
One is a React framework for web, iOS, and Android apps.
75 lines (72 loc) • 2.54 kB
JavaScript
import { jsx } from "react/jsx-runtime";
import { useEffect, useMemo } from "react";
import { useNavigation } from "@react-navigation/native";
import { NAVIGATOR_CONFIG } from "../../headless/children.native.js";
import { PLATFORM } from "../../utils/platform.native.js";
import { TOOLBAR_KIND, appendStackToolbarPropsToOptions, appendStackToolbarPropsToOptions as appendStackToolbarPropsToOptions2, isToolbarKind } from "./stackToolbarDescriptors.native.js";
import { BottomToolbarHost } from "./StackToolbarBottomHost.native.js";
function mark(component, kind) {
return Object.assign(component, {
[NAVIGATOR_CONFIG]: true,
[TOOLBAR_KIND]: kind
});
}
function StackToolbarComponent(props) {
var _props_placement;
var placement = (_props_placement = props.placement) !== null && _props_placement !== void 0 ? _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(param) {
var { props } = param;
var navigation = useNavigation();
var options = useMemo(function() {
return appendStackToolbarPropsToOptions({}, props);
}, [
props.children,
props.placement,
props.asChild
]);
useEffect(function() {
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.native.js.map