import type { VariantProps } from 'class-variance-authority'; import type { LucideIcon } from 'lucide-react-native'; import * as React from 'react'; import { toggleTextVariants, toggleVariants } from '@/components/ui/toggle'; import { TextClassContext } from '@/components/ui/text'; import * as ToggleGroupPrimitive from '@rn-primitives/toggle-group'; import { cn } from '@/lib/utils'; const ToggleGroupContext = React.createContext | null>(null); const ToggleGroup = React.forwardRef< ToggleGroupPrimitive.RootRef, ToggleGroupPrimitive.RootProps & VariantProps >(({ className, variant, size, children, ...props }, ref) => ( {children} )); ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName; function useToggleGroupContext() { const context = React.useContext(ToggleGroupContext); if (context === null) { throw new Error( 'ToggleGroup compound components cannot be rendered outside the ToggleGroup component' ); } return context; } const ToggleGroupItem = React.forwardRef< ToggleGroupPrimitive.ItemRef, ToggleGroupPrimitive.ItemProps & VariantProps >(({ className, children, variant, size, ...props }, ref) => { const context = useToggleGroupContext(); const { value } = ToggleGroupPrimitive.useRootContext(); return ( {children} ); }); ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName; function ToggleGroupIcon({ className, icon: Icon, ...props }: React.ComponentPropsWithoutRef & { icon: LucideIcon; }) { const textClass = React.useContext(TextClassContext); return ; } export { ToggleGroup, ToggleGroupIcon, ToggleGroupItem };