import { ReactElement, ReactNode } from "react"; import { CopyAction } from "./actions/CopyAction"; import { cn } from "../../../../lib/utils"; import { Icon, IconType } from "../../../Icon"; import { View, Text } from "react-native"; import { GenericAction } from "./actions/GenericAction"; import { ActionType } from "."; type ItemContainerProps = { leftIcon?: IconType | (() => ReactElement); action?: ActionType; text: string; className?: string; }; export const ItemContainer = (props: ItemContainerProps) => { const { text, leftIcon: LeftIcon, className, action = { type: "noop" }, } = props; return ( {LeftIcon && (typeof LeftIcon === "function" ? ( LeftIcon({}) ) : ( ))} {text} ); }; const Action = ({ children, action, ...props }: { className: string; action: ActionType; children: ReactNode; }) => { const type = action.type; switch (type) { case "copy": return ( {children} ); case "generic": return ( {children} ); case "noop": return {children}; default: { const _exhaustiveCheck: never = type; return _exhaustiveCheck; } } };