chore: Migrate separator room to ts

This commit is contained in:
AlexAlexandre 2021-12-01 23:31:02 -03:00
parent 161e667678
commit 3c5d0f127c
1 changed files with 7 additions and 8 deletions

View File

@ -1,6 +1,5 @@
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import PropTypes from 'prop-types';
import moment from 'moment';
import I18n from '../../i18n';
@ -34,7 +33,13 @@ const styles = StyleSheet.create({
}
});
const DateSeparator = React.memo(({ ts, unread, theme }) => {
interface IRoomDateSeparatorProps {
ts: Date;
unread: boolean;
theme: string;
}
const DateSeparator = React.memo(({ ts, unread, theme }: IRoomDateSeparatorProps) => {
const date = ts ? moment(ts).format('LL') : null;
const unreadLine = { backgroundColor: themes[theme].dangerColor };
const unreadText = { color: themes[theme].dangerColor };
@ -63,10 +68,4 @@ const DateSeparator = React.memo(({ ts, unread, theme }) => {
);
});
DateSeparator.propTypes = {
ts: PropTypes.instanceOf(Date),
unread: PropTypes.bool,
theme: PropTypes.string
};
export default DateSeparator;