import React from 'react'; import { View, Text } from 'react-native'; import PropTypes from 'prop-types'; import { formatLastMessage, formatMessageCount } from './utils'; import styles from './styles'; import { CustomIcon } from '../../lib/Icons'; import { THREAD } from './constants'; const Thread = React.memo(({ msg, tcount, tlm, customThreadTimeFormat }) => { if (!tlm) { return null; } const time = formatLastMessage(tlm, customThreadTimeFormat); const buttonText = formatMessageCount(tcount, THREAD); return ( {buttonText} {time} ); }, (prevProps, nextProps) => { if (prevProps.tcount !== nextProps.tcount) { return false; } return true; }); Thread.propTypes = { msg: PropTypes.string, tcount: PropTypes.string, tlm: PropTypes.string, customThreadTimeFormat: PropTypes.string }; Thread.displayName = 'MessageThread'; export default Thread;