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-12 16:27:05 +00:00
|
|
|
import { TSupportedThemes } from '../../theme';
|
2021-09-13 20:41:05 +00:00
|
|
|
|
|
|
|
interface IUpdatedAt {
|
|
|
|
date: string;
|
2022-04-12 16:27:05 +00:00
|
|
|
theme: TSupportedThemes;
|
2021-09-13 20:41:05 +00:00
|
|
|
hideUnreadStatus: boolean;
|
|
|
|
alert: boolean;
|
|
|
|
}
|
|
|
|
|
|
|
|
const UpdatedAt = React.memo(({ date, theme, hideUnreadStatus, alert }: IUpdatedAt) => {
|
|
|
|
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;
|