{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "switch",
  "title": "Switch",
  "type": "registry:ui",
  "files": [
    {
      "path": "packages/registry-native/components/switch/Switch.tsx",
      "content": "import * as React from 'react'\nimport { Switch as RNSwitch, type SwitchProps as RNSwitchProps } from 'react-native'\nimport { useThemeColors } from '@/lib/theme'\n\nexport interface SwitchProps extends RNSwitchProps {\n  checked?: boolean\n  defaultChecked?: boolean\n  onCheckedChange?: (checked: boolean) => void\n}\n\nfunction Switch({\n  checked,\n  defaultChecked,\n  onCheckedChange,\n  onValueChange,\n  value,\n  accessibilityState,\n  ...props\n}: SwitchProps) {\n  const colors = useThemeColors()\n  const isControlled = checked !== undefined || value !== undefined\n  const [internal, setInternal] = React.useState(defaultChecked ?? value ?? false)\n  const resolved = (checked ?? value ?? internal) as boolean\n\n  function handleChange(next: boolean) {\n    if (!isControlled) setInternal(next)\n    onCheckedChange?.(next)\n    onValueChange?.(next)\n  }\n\n  return (\n    <RNSwitch\n      accessibilityRole=\"switch\"\n      accessibilityState={{\n        ...accessibilityState,\n        checked: resolved,\n        disabled: props.disabled ?? accessibilityState?.disabled,\n      }}\n      trackColor={{ false: colors.input, true: colors.primary }}\n      thumbColor={resolved ? colors.switchThumbChecked : colors.switchThumb}\n      ios_backgroundColor={colors.input}\n      value={resolved}\n      onValueChange={handleChange}\n      {...props}\n    />\n  )\n}\n\nexport { Switch }\n",
      "type": "registry:ui",
      "target": "~/components/ui/switch/Switch.tsx"
    },
    {
      "path": "packages/registry-native/components/switch/index.ts",
      "content": "export { Switch, type SwitchProps } from './Switch'\n",
      "type": "registry:ui",
      "target": "~/components/ui/switch/index.ts"
    }
  ],
  "dependencies": [],
  "devDependencies": [],
  "registryDependencies": [],
  "description": "Themed controlled/uncontrolled RN Switch wrapper. Same checked API as web Switch.",
  "categories": [
    "control"
  ]
}