import { forwardRef } from 'react'; import type { Switch as RNSwitch, View } from 'react-native'; import { dataAttributes, mergeDataAttributes, useSwitch, type ISwitchProps, } from '@cdx-ui/primitives'; import { BaseSwitch } from './BaseSwitch'; export interface SwitchProps extends ISwitchProps { /** * Track and thumb size. * @default 'md' */ size?: 'sm' | 'md' | 'lg'; /** Additional Uniwind/Tailwind classes, merged after the switch's own styles. */ className?: string; /** Accessible label announced by screen readers. */ accessibilityLabel?: string; /** Called when the switch receives focus. */ onFocus?: () => void; /** Called when the switch loses focus. */ onBlur?: () => void; } export const Switch = forwardRef( ( { className, size, value, isChecked, defaultValue, disabled, isDisabled, isInvalid, onValueChange, ...props }, ref, ) => { const switchState = useSwitch({ value, isChecked, defaultValue, disabled, isDisabled, isInvalid, onValueChange, }); return ( ); }, ); Switch.displayName = 'Switch';