import { Pressable, View } from 'react-native'; import { useColors } from '../../hook'; import { useI18nContext } from '../../i18n'; import { usePaletteContext } from '../../theme'; import { SingleLineText } from '../../ui/Text'; import { StatusAvatar } from '../Avatar'; import { TopNavigationBar, TopNavigationBarLeft, TopNavigationBarRight, TopNavigationBarTitle, } from '../TopNavigationBar'; import type { ContactListNavigationBarProps } from './types'; type _ContactListNavigationBarProps = ContactListNavigationBarProps & { userId?: string; selectedCount?: number; selectedMemberCount?: number; avatarUrl?: string; onClickedAddGroupParticipant?: () => void; onClickedCreateGroup?: () => void; onClickedAvatar?: () => void; }; export const ContactListNavigationBar = ( props: _ContactListNavigationBarProps ) => { const { userId, contactType, avatarUrl, onClickedNewContact, onBack, onClickedCreateGroup, selectedCount, onClickedAddGroupParticipant, selectedMemberCount, customNavigationBar, onClickedAvatar, } = props; const { tr } = useI18nContext(); const { colors } = usePaletteContext(); const { getColor } = useColors({ text_disable: { light: colors.neutral[7], dark: colors.neutral[3], }, }); if (customNavigationBar) { return <>{customNavigationBar}; } if (contactType === 'contact-list') { return ( } Right={TopNavigationBarRight} RightProps={{ onClicked: onClickedNewContact, iconName: 'person_add', }} Title={} /> ); } else if (contactType === 'new-conversation') { return ( {tr('cancel')} } Right={} Title={} /> ); } else if (contactType === 'create-group') { return ( } Right={ 0 ? false : true} > {tr('_uikit_create_group_button', selectedCount)} } Title={} /> ); } else if (contactType === 'add-group-member') { return ( } Right={ 0 ? false : true } > {tr('_uikit_add_group_member_button', selectedMemberCount)} } Title={} /> ); } else if (contactType === 'share-contact') { return ( {tr('cancel')} } Right={} Title={} /> ); } else { return null; } };