one
Version:
One is a new React Framework that makes Vite serve both native and web.
93 lines (91 loc) • 3.19 kB
JavaScript
"use client";
import { useMemo } from "react";
import { useIsomorphicLayoutEffect } from "@vxrn/use-isomorphic-layout-effect";
import { NAVIGATOR_CONFIG } from "../../headless/children.native.js";
import { useNavigation } from "../../router/useNavigation.native.js";
import { STACK_TOOLBAR_CHILD, getStackToolbarImplementation } from "./StackToolbarImplementation.native.js";
import { appendStackToolbarConfig } from "./StackToolbar.shared.native.js";
function appendStackToolbarPropsToOptions(options, props, implementation) {
var optionsWithConfig = appendStackToolbarConfig(options, props);
return implementation ? implementation.appendPropsToOptions(optionsWithConfig, props) : optionsWithConfig;
}
function StackToolbarComponent(props) {
var _ref;
var navigation = useNavigation();
var implementation = getStackToolbarImplementation();
var options = useMemo(function () {
return appendStackToolbarPropsToOptions({}, props, implementation);
}, [implementation, props.placement, props.asChild, props.children, props.disableImePadding, props.tintColor, props.backgroundColor]);
useIsomorphicLayoutEffect(function () {
navigation.setOptions(options);
}, [navigation, options]);
return (_ref = implementation === null || implementation === void 0 ? void 0 : implementation.render(props)) !== null && _ref !== void 0 ? _ref : null;
}
function StackToolbarButton(_props) {
return null;
}
function StackToolbarMenu(_props) {
return null;
}
function StackToolbarMenuAction(_props) {
return null;
}
function StackToolbarSpacer(_props) {
return null;
}
function StackToolbarSearchBarSlot(_props) {
return null;
}
function StackToolbarView(_props) {
return null;
}
function StackToolbarLabel(_props) {
return null;
}
function StackToolbarIcon(_props) {
return null;
}
function StackToolbarBadge(_props) {
return null;
}
Object.assign(StackToolbarButton, {
[STACK_TOOLBAR_CHILD]: "button"
});
Object.assign(StackToolbarMenu, {
[STACK_TOOLBAR_CHILD]: "menu"
});
Object.assign(StackToolbarMenuAction, {
[STACK_TOOLBAR_CHILD]: "menuAction"
});
Object.assign(StackToolbarSpacer, {
[STACK_TOOLBAR_CHILD]: "spacer"
});
Object.assign(StackToolbarSearchBarSlot, {
[STACK_TOOLBAR_CHILD]: "searchBarSlot"
});
Object.assign(StackToolbarView, {
[STACK_TOOLBAR_CHILD]: "view"
});
Object.assign(StackToolbarLabel, {
[STACK_TOOLBAR_CHILD]: "label"
});
Object.assign(StackToolbarIcon, {
[STACK_TOOLBAR_CHILD]: "icon"
});
Object.assign(StackToolbarBadge, {
[STACK_TOOLBAR_CHILD]: "badge"
});
var StackToolbar = Object.assign(StackToolbarComponent, {
[NAVIGATOR_CONFIG]: true,
Button: StackToolbarButton,
Menu: StackToolbarMenu,
MenuAction: StackToolbarMenuAction,
Spacer: StackToolbarSpacer,
SearchBarSlot: StackToolbarSearchBarSlot,
View: StackToolbarView,
Label: StackToolbarLabel,
Icon: StackToolbarIcon,
Badge: StackToolbarBadge
});
export { StackToolbar, StackToolbarBadge, StackToolbarButton, StackToolbarIcon, StackToolbarLabel, StackToolbarMenu, StackToolbarMenuAction, StackToolbarSearchBarSlot, StackToolbarSpacer, StackToolbarView, appendStackToolbarPropsToOptions };
//# sourceMappingURL=StackToolbar.native.js.map