{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "share",
  "title": "Share",
  "description": "OS share sheet · copies to the clipboard on web",
  "dependencies": [
    "expo-clipboard@~57.0.2"
  ],
  "registryDependencies": [
    "@kit-native/lib-haptics",
    "@kit-native/toast"
  ],
  "files": [
    {
      "path": "components/kit/share.ts",
      "content": "import { useToast } from '@/components/kit/toast';\nimport { haptic } from '@/lib/haptics';\nimport * as Clipboard from 'expo-clipboard';\nimport * as React from 'react';\nimport { Share } from 'react-native';\n\nexport type SharePayload = { message?: string; url?: string; title?: string };\nexport type ShareResult = 'shared' | 'dismissed' | 'copied' | 'failed';\n\n/**\n * The OS share sheet, falling back to a clipboard copy on the web preview.\n *\n * A hook rather than a component, like `useToast` — sharing is a one-shot action with\n * no resting visual state, so the trigger is an ordinary Button.\n */\nexport function useShare() {\n  const toast = useToast();\n\n  const share = React.useCallback(\n    async (payload: SharePayload): Promise<ShareResult> => {\n      const text = [payload.message, payload.url].filter(Boolean).join(' ');\n      try {\n        haptic('selection');\n        const result = await Share.share(\n          { message: payload.message ?? payload.url ?? '', url: payload.url, title: payload.title },\n          { dialogTitle: payload.title }\n        );\n        return result.action === Share.sharedAction ? 'shared' : 'dismissed';\n      } catch {\n        // react-native-web rejects when navigator.share is missing — copy instead,\n        // which is still a real, satisfying interaction in the browser preview.\n        try {\n          await Clipboard.setStringAsync(text);\n          toast.success('Copied to the clipboard');\n          return 'copied';\n        } catch {\n          toast.error('Could not share that');\n          return 'failed';\n        }\n      }\n    },\n    [toast]\n  );\n\n  return { share };\n}\n",
      "type": "registry:component",
      "target": "components/kit/share.ts"
    }
  ],
  "meta": {
    "exports": [
      "useShare"
    ],
    "api": "const { share } = useShare(); share({ message?, url?, title? })"
  },
  "docs": "Run `npx expo install --fix` afterwards so Expo SDK packages match your SDK. Needs the kit theme (`@kit-native/theme`) and `KitThemeProvider` from `@kit-native/lib-theme-context` at the root.",
  "categories": [
    "native"
  ],
  "type": "registry:component"
}