{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "command", "type": "registry:ui", "title": "Command", "description": "Searchable command palette modal.", "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/command.tsx", "type": "registry:ui", "target": "components/ui/command.tsx", "content": "import { Search } from 'lucide-react-native';\nimport { useState } from 'react';\nimport { Modal, Pressable, ScrollView, TextInput, View } from 'react-native';\nimport { Text } from '@/components/ui/text';\nimport { useIconColor, useThemeColor } from '@/lib/utils';\n\nexport interface CommandItemData {\n label: string;\n value: string;\n group?: string;\n}\n\nexport interface CommandProps {\n open: boolean;\n onOpenChange?: (open: boolean) => void;\n items: CommandItemData[];\n onSelect?: (item: CommandItemData) => void;\n placeholder?: string;\n emptyText?: string;\n className?: string;\n}\n\nexport function Command({\n open,\n onOpenChange,\n items,\n onSelect,\n placeholder = 'Search…',\n emptyText = 'No results.',\n className,\n}: CommandProps) {\n const [query, setQuery] = useState('');\n const muted = useIconColor();\n const colors = useThemeColor();\n const filtered = query\n ? items.filter((i) => i.label.toLowerCase().includes(query.toLowerCase()))\n : items;\n\n return (\n onOpenChange?.(false)}\n >\n onOpenChange?.(false)}\n >\n e.stopPropagation()}\n >\n \n \n \n \n \n {filtered.length === 0 ? (\n \n {emptyText}\n \n ) : (\n filtered.map((item, i) => (\n \n {item.group && item.group !== filtered[i - 1]?.group && (\n \n {item.group}\n \n )}\n {\n onSelect?.(item);\n onOpenChange?.(false);\n setQuery('');\n }}\n className=\"rounded-md px-3 py-2.5 active:bg-accent\"\n >\n \n {item.label}\n \n \n \n ))\n )}\n \n \n \n \n );\n}\n" } ] }