// components/ui/radio-group.tsx import * as React from 'react'; import { View, Text, Pressable } from 'react-native'; import { cn } from '../../lib/utils'; interface RadioGroupProps { value?: string; onValueChange?: (value: string) => void; children: React.ReactNode; className?: string; } interface RadioGroupItemProps { value: string; id?: string; children?: React.ReactNode; className?: string; } const RadioGroupContext = React.createContext<{ value?: string; onValueChange?: (value: string) => void; } | null>(null); function useRadioGroup() { const context = React.useContext(RadioGroupContext); if (!context) { throw new Error('RadioGroupItem must be used within RadioGroup'); } return context; } export function RadioGroup({ value, onValueChange, children, className }: RadioGroupProps) { return ( {children} ); } export function RadioGroupItem({ value, id, children, className }: RadioGroupItemProps) { const { value: selectedValue, onValueChange } = useRadioGroup(); const isSelected = selectedValue === value; return ( onValueChange?.(value)} className={cn('flex-row items-center gap-3', className)} > {/* Radio Circle */} {isSelected && ( )} {/* Label */} {children} ); } export function RadioGroupLabel({ children, className }: { children: React.ReactNode; className?: string }) { return ( {children} ); }