chore: Migrate separator room to ts
This commit is contained in:
parent
161e667678
commit
3c5d0f127c
|
@ -1,6 +1,5 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { StyleSheet, Text, View } from 'react-native';
|
import { StyleSheet, Text, View } from 'react-native';
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
|
||||||
import I18n from '../../i18n';
|
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 date = ts ? moment(ts).format('LL') : null;
|
||||||
const unreadLine = { backgroundColor: themes[theme].dangerColor };
|
const unreadLine = { backgroundColor: themes[theme].dangerColor };
|
||||||
const unreadText = { color: 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;
|
export default DateSeparator;
|
Loading…
Reference in New Issue