import * as React from 'react'; import { View } from 'react-native'; import { useColors } from '../../hook'; import { useI18nContext } from '../../i18n'; import { usePaletteContext } from '../../theme'; import { Text2Button } from '../../ui/Button'; import { PressableHighlight } from '../../ui/Pressable'; import { SingleLineText } from '../../ui/Text'; import { GroupAvatar } from '../Avatar'; import type { GroupListItemProps } from './types'; /** * Group List Item Component. */ export function GroupListItem(props: GroupListItemProps) { const { data, onClicked, onLongPressed, groupType = 'common' } = props; const { forwarded } = data; const { tr } = useI18nContext(); const { colors } = usePaletteContext(); const { getColor } = useColors({ t2: { light: colors.neutral[5], dark: colors.neutral[6], }, btn_bg: { light: colors.neutral[95], dark: colors.neutral[2], }, }); return ( { onClicked?.(data); }} onLongPress={() => { onLongPressed?.(data); }} > {data.groupName === undefined || data.groupName.length === 0 ? data.groupId : data.groupName} {groupType === 'forward-message' ? ( <> { onClicked?.(data); }} /> ) : null} ); } export const GroupListItemMemo = React.memo(GroupListItem);