import { useMemo, type ReactNode } from 'react' import { ScrollView, View, type StyleProp, type ViewProps, type ViewStyle } from 'react-native' import { useTheme } from '../../global-contexts/theme/ThemeContext' import type { ChatConversationListFooterStyle, ChatConversationListHeaderStyle, ChatConversationListStyle } from '../../theme/types/components/chat' import type { StyleOverwrite } from '../../theme/types/resolver' export type ChatConversationListProps = Omit & { header?: ReactNode, footer?: ReactNode, children?: ReactNode, style?: StyleProp, listStyle?: StyleOverwrite, ChatConversationListStyle>, headerStyle?: StyleOverwrite, ChatConversationListHeaderStyle>, contentStyle?: StyleProp, footerStyle?: StyleOverwrite, ChatConversationListFooterStyle>, } export const ChatConversationList = ({ header, footer, children, style, listStyle, headerStyle, contentStyle, footerStyle, ...props }: ChatConversationListProps) => { const { theme } = useTheme() const state = useMemo(() => ({}), []) const resolvedListStyle = useMemo( () => theme.components.chat.conversationList.container(state, listStyle), [theme, state, listStyle] ) const resolvedHeaderStyle = useMemo( () => theme.components.chat.conversationList.header(state, headerStyle), [theme, state, headerStyle] ) const resolvedFooterStyle = useMemo( () => theme.components.chat.conversationList.footer(state, footerStyle), [theme, state, footerStyle] ) return ( {header != null && ( {header} )} {children} {footer != null && ( {footer} )} ) }