import { Card, Divider, Text, TouchableRipple } from 'react-native-paper'; import React from 'react'; import { StyleSheet, View, ViewStyle,} from 'react-native'; import { AvatarPresenceBadge } from '../presence'; import { Strings } from '../../resources/localization/Strings'; import { IContact, Presence } from '../../store/contacts/types'; import { ImageButton } from '../common/ImageButton'; import { IStyledProps } from '../common/types'; interface IProps extends IStyledProps { contact: IContact; onClickItem: (contact: IContact) => void; onCallPress?: (contact: IContact) => void; onChatPress?: (contact: IContact) => void; } export interface IContactItemStyleProps { card?: ViewStyle; container?:ViewStyle; row?:ViewStyle; contactInfo?:ViewStyle; cardAction?:ViewStyle; divider?:ViewStyle; } export const ContactItemView: React.FunctionComponent = ({ contact, style, onClickItem, onCallPress, onChatPress, }) => { const mergedStyle = { ...defaultStyle, ...style }; const contactPresence = contact.presence as keyof typeof Presence; const onPressItem = () => { onClickItem(contact); }; return ( {contact.name} {contact.isOffice365 && {contact.jobTitle}} {contact.isPhoneBook && {contact.firstAvailableNumber}} {contact.isRoster && {Strings[contactPresence]}} {onCallPress && ( onCallPress(contact)} /> )} {/* {onChatPress && ( onChatPress(contact)} /> )} */} ) }; const defaultStyle: IContactItemStyleProps = StyleSheet.create({ card: { borderWidth: 0, paddingVertical: 8, paddingHorizontal: 16, }, container: { flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', paddingHorizontal: 16, }, row: { flexDirection: 'row', alignItems: 'center', }, contactInfo: { marginLeft: 16, }, actions: { flexDirection: 'row', alignItems: 'center', }, divider: { backgroundColor: '#E0E0E0', marginHorizontal: 16, height: 1, }, });