2021-09-13 20:41:05 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { Text } from 'react-native';
|
|
|
|
|
|
|
|
import styles from './styles';
|
2022-04-07 14:10:03 +00:00
|
|
|
import { themes } from '../../lib/constants';
|
2021-09-13 20:41:05 +00:00
|
|
|
import { capitalize } from '../../utils/room';
|
2022-04-20 21:37:54 +00:00
|
|
|
import { IUpdatedAtProps } from './interfaces';
|
2021-09-13 20:41:05 +00:00
|
|
|
|
2022-04-20 21:37:54 +00:00
|
|
|
const UpdatedAt = React.memo(({ date, theme, hideUnreadStatus, alert }: IUpdatedAtProps) => {
|
2021-09-13 20:41:05 +00:00
|
|
|
if (!date) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
return (
|
|
|
|
<Text
|
|
|
|
style={[
|
|
|
|
styles.date,
|
|
|
|
{
|
|
|
|
color: themes[theme].auxiliaryText
|
|
|
|
},
|
|
|
|
alert &&
|
|
|
|
!hideUnreadStatus && [
|
|
|
|
styles.updateAlert,
|
|
|
|
{
|
|
|
|
color: themes[theme].tintColor
|
|
|
|
}
|
|
|
|
]
|
|
|
|
]}
|
|
|
|
ellipsizeMode='tail'
|
|
|
|
numberOfLines={1}>
|
|
|
|
{capitalize(date)}
|
|
|
|
</Text>
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
export default UpdatedAt;
|