{
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
"name": "dialog",
"type": "registry:ui",
"title": "Dialog",
"description": "Modal dialog with title/description/footer slots.",
"registryDependencies": [
"https://raw.githubusercontent.com/truongnat/rnui/main/registry/dist/nativewind/utils.json",
"https://raw.githubusercontent.com/truongnat/rnui/main/registry/dist/nativewind/text.json",
"https://raw.githubusercontent.com/truongnat/rnui/main/registry/dist/nativewind/theme.json"
],
"dependencies": [
"lucide-react-native"
],
"files": [
{
"path": "registry/shared/ui/dialog.tsx",
"type": "registry:ui",
"target": "components/ui/dialog.tsx",
"content": "import { X } from 'lucide-react-native';\nimport { createContext, type ReactNode, useContext } from 'react';\nimport {\n Modal,\n Pressable,\n View,\n type PressableProps,\n type ViewProps,\n} from 'react-native';\nimport { Text, type TextProps } from '@/components/ui/text';\nimport { cn, useIconColor } from '@/lib/utils';\n\nconst DialogContext = createContext<((open: boolean) => void) | null>(null);\n\nexport interface DialogProps {\n open: boolean;\n onOpenChange?: (open: boolean) => void;\n /** Render the corner close affordance, like shadcn DialogContent. */\n showClose?: boolean;\n children?: ReactNode;\n}\n\nexport function Dialog({\n open,\n onOpenChange,\n showClose = true,\n children,\n}: DialogProps) {\n const iconColor = useIconColor('muted');\n return (\n onOpenChange?.(false)}\n >\n onOpenChange?.(false)}\n >\n e.stopPropagation()}\n >\n \n {showClose && (\n onOpenChange?.(false)}\n className=\"absolute right-4 top-4 rounded-sm p-1 active:opacity-70\"\n >\n \n \n )}\n {children}\n \n \n \n \n );\n}\n\nexport function DialogClose({\n onPress,\n children,\n className,\n ...props\n}: PressableProps & { className?: string }) {\n const onOpenChange = useContext(DialogContext);\n return (\n {\n onPress?.(e);\n onOpenChange?.(false);\n }}\n className={className}\n {...props}\n >\n {children}\n \n );\n}\n\nexport function DialogTitle({ className, ...props }: TextProps) {\n return (\n \n );\n}\n\nexport function DialogDescription({ className, ...props }: TextProps) {\n return (\n \n );\n}\n\nexport function DialogFooter({\n className,\n ...props\n}: ViewProps & { className?: string }) {\n return (\n \n );\n}\n"
}
]
}