'use client'; import * as React from 'react'; import { View } from 'react-native'; import { useRenderElement } from '../../use-render/useRenderElement'; import { useId } from '../../hooks/useId'; import { EMPTY_OBJECT } from '../../utils/empty'; import type { ZestUIComponentProps } from '../../types'; import { MenuGroupContext } from './MenuGroupContext'; /** * Groups related menu items with the corresponding label. * Renders a ``. */ export function MenuGroup(componentProps: MenuGroup.Props) { const { render, className, style, ref, ...elementProps } = componentProps; const labelId = useId(); const contextValue: MenuGroupContext = React.useMemo(() => ({ labelId }), [labelId]); const state: MenuGroupState = EMPTY_OBJECT; const element = useRenderElement(View, componentProps, { state, ref, props: [ { role: 'group' as const, accessibilityLabelledBy: labelId, 'aria-labelledby': labelId, }, elementProps, ], }); return {element}; } export interface MenuGroupState {} export interface MenuGroupProps extends ZestUIComponentProps {} export namespace MenuGroup { export type State = MenuGroupState; export type Props = MenuGroupProps; }