{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "message-input", "type": "registry:ui", "title": "Message Input", "description": "Multiline input row with send button.", "registryDependencies": [ "https://raw.githubusercontent.com/truongnat/rnui/main/registry/dist/nativewind/utils.json", "https://raw.githubusercontent.com/truongnat/rnui/main/registry/dist/nativewind/theme.json", "https://raw.githubusercontent.com/truongnat/rnui/main/registry/dist/nativewind/input.json" ], "dependencies": [ "lucide-react-native" ], "files": [ { "path": "registry/shared/ui/message-input.tsx", "type": "registry:ui", "target": "components/ui/message-input.tsx", "content": "import { useState } from 'react';\nimport { Pressable, View, type ViewProps } from 'react-native';\nimport { SendHorizontal } from 'lucide-react-native';\nimport { Input } from '@/components/ui/input';\nimport { cn, useIconColor } from '@/lib/utils';\n\nexport interface MessageInputProps extends ViewProps {\n value?: string;\n onChange?: (text: string) => void;\n /** Called with the current text; clears the input when uncontrolled. */\n onSend?: (text: string) => void;\n placeholder?: string;\n className?: string;\n}\n\nexport function MessageInput({\n value,\n onChange,\n onSend,\n placeholder = 'Message…',\n className,\n ...props\n}: MessageInputProps) {\n const [inner, setInner] = useState('');\n const text = value ?? inner;\n const setText = (t: string) => {\n if (value === undefined) setInner(t);\n onChange?.(t);\n };\n const send = () => {\n const t = text.trim();\n if (!t) return;\n onSend?.(t);\n if (value === undefined) setInner('');\n };\n const iconColor = useIconColor('onPrimary');\n\n return (\n \n \n \n \n \n \n );\n}\n" } ] }