import { SearchResult } from "@/store/api/searchApi"; import { normalizeEnumLike } from "@/utils/formattingUtils"; import { memo } from "react"; import { Text, View, TouchableOpacity } from "react-native"; import { Card, Divider } from "react-native-paper"; interface ResultRowProps { item: SearchResult; expanded: boolean; onToggle: (id: string) => void; } const ResultRowComponent = ({ item, expanded, onToggle }: ResultRowProps) => { return ( onToggle(item.id)}> {item.title} {item.subtitle ? ( {normalizeEnumLike(item.subtitle)} ) : null} {item.description ? ( {normalizeEnumLike(item.description)} ) : null} {expanded && ( Type:{" "} {item.type.charAt(0).toUpperCase() + item.type.slice(1).toLowerCase()} {item.createdAt ? ( Created: {new Date(item.createdAt).toLocaleString()} ) : null} {item.meta ? ( <> {item.type !== "todo" ? ( <> {item.meta?.isLocked !== undefined ? ( Locked: {item.meta.isLocked ? "Yes" : "No"} ) : null} ) : ( <> {item.meta?.createdBy ? ( Created by: {item.meta.createdBy} ) : null} {item.meta?.assignees ? ( Assignees: {item.meta.assignees} ) : null} )} ) : null} )} ); }; export const ResultRow = memo(ResultRowComponent); ResultRow.displayName = "ResultRow";