{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "chat-list-item", "type": "registry:ui", "title": "Chat List Item", "description": "Conversation row: avatar, name, preview, time, unread badge.", "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", "https://raw.githubusercontent.com/truongnat/rnui/main/registry/dist/nativewind/avatar.json", "https://raw.githubusercontent.com/truongnat/rnui/main/registry/dist/nativewind/badge.json" ], "files": [ { "path": "registry/shared/ui/chat-list-item.tsx", "type": "registry:ui", "target": "components/ui/chat-list-item.tsx", "content": "import { Pressable, View, type ViewProps } from 'react-native';\nimport { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';\nimport { Badge } from '@/components/ui/badge';\nimport { Text } from '@/components/ui/text';\nimport { cn } from '@/lib/utils';\n\nexport interface ChatListItemProps extends ViewProps {\n name: string;\n /** Last message preview. */\n message?: string;\n /** Right-aligned timestamp text. */\n time?: string;\n unreadCount?: number;\n /** Avatar image uri. */\n avatarUrl?: string;\n /** Fallback text (initials). */\n fallback?: string;\n /** Online indicator dot. */\n online?: boolean;\n /** Extra classes for the online dot (e.g. `bg-sky-500`). */\n presenceClassName?: string;\n onPress?: () => void;\n className?: string;\n}\n\nexport function ChatListItem({\n name,\n message,\n time,\n unreadCount = 0,\n avatarUrl,\n fallback,\n online,\n presenceClassName,\n onPress,\n className,\n ...props\n}: ChatListItemProps) {\n return (\n \n \n \n \n {avatarUrl && }\n \n {fallback ?? name.slice(0, 2).toUpperCase()}\n \n \n {online && (\n \n )}\n \n \n \n \n {name}\n \n {time && (\n {time}\n )}\n \n \n \n {message}\n \n {unreadCount > 0 && (\n \n {unreadCount > 99 ? '99+' : unreadCount}\n \n )}\n \n \n \n \n );\n}\n" } ] }