import * as React from 'react'; import { Dimensions, Pressable, View } from 'react-native'; import { ScrollView } from 'react-native-gesture-handler'; import { useColors } from '../../hook'; import { usePaletteContext, useThemeContext } from '../../theme'; import { Alert } from '../../ui/Alert'; import { CmnButton } from '../../ui/Button'; import { Icon } from '../../ui/Image'; import { CommonSwitch } from '../../ui/Switch'; import { SingleLineText } from '../../ui/Text'; import { SimpleToast } from '../../ui/Toast'; import { StatusAvatar } from '../Avatar'; import { BackButton } from '../Back'; import { BottomSheetNameMenu } from '../BottomSheetMenu'; import { ListItem } from '../ListItem'; import { TopNavigationBar } from '../TopNavigationBar'; import { BlockButtons } from './BlockButtons'; import { useContactInfo } from './ContactInfo.hooks'; import type { ContactInfoProps, ContactInfoRef } from './types'; /** * Contact Info Component. * * If it is a contact, the send button is displayed, if it is not a contact, the add contact button is displayed. If it is the current user, there are no operation options. */ export const ContactInfo = React.forwardRef( function (props: ContactInfoProps, ref?: React.ForwardedRef) { const { onBack, // hasAudioCall = false, hasSendMessage = true, // hasVideoCall = false, containerStyle, navigationBarVisible, customNavigationBar, onInitButton, customItemRender, } = props; const { doNotDisturb, onDoNotDisturb, blockUser, onBlockUser, onClearChat, userId, userAvatar, isContact, onSendMessage, onAudioCall, onVideoCall, alertRef, menuRef, toastRef, onRequestCloseMenu, onMore, tr, isSelf, onAddContact, onCopyId, getNickName, onSearch, hasAudioCall, enableBlock, switchRef, } = useContactInfo(props, ref); const { cornerRadius } = useThemeContext(); const { input } = cornerRadius; const { colors } = usePaletteContext(); const { getColor } = useColors({ t1: { light: colors.neutral[5], dark: colors.neutral[6], }, t2: { light: colors.neutral[3], dark: colors.neutral[95], }, t3: { light: colors.neutral[7], dark: colors.neutral[6], }, }); const customListItem = React.useCallback(() => { const items = [] as React.ReactNode[]; if (isContact === true) { items.push(); // items.push( // // {tr('_uikit_info_item_contact_remark')} // // } // RightText={ // // {userRemark} // // } // RightIcon={ // // // // } // /> // ); items.push( ); items.push( {tr('_uikit_info_not_disturb')} } RightIcon={ {doNotDisturb !== undefined ? ( ) : null} } /> ); if (enableBlock === true) { items.push( {tr('_uikit_info_block_list')} } RightIcon={ {blockUser !== undefined ? ( ) : null} } /> ); } items.push( {tr('_uikit_info_clear_msg')} } /> ); } else if (isSelf !== true) { items.push( ); } return ( {customItemRender ? customItemRender(items) : items} ); }, [ blockUser, customItemRender, doNotDisturb, enableBlock, getColor, input, isContact, isSelf, onAddContact, onBlockUser, onClearChat, onDoNotDisturb, switchRef, tr, ]); return ( {navigationBarVisible !== false ? ( customNavigationBar ? ( <>{customNavigationBar} ) : ( } Right={ } /> ) ) : null} {getNickName()} {doNotDisturb === true ? ( ) : null} {tr('_uikit_info_item_contact_id')} {userId} {isContact === true ? ( <> ) : null} {customListItem()} ); } );