2020-10-30 13:59:44 +00:00
|
|
|
import React from 'react';
|
2021-10-01 18:12:19 +00:00
|
|
|
import { StyleSheet, Text, View } from 'react-native';
|
2020-10-30 13:59:44 +00:00
|
|
|
|
|
|
|
import sharedStyles from '../../views/Styles';
|
2022-04-28 18:44:40 +00:00
|
|
|
import { themes } from '../../lib/constants';
|
2020-10-30 13:59:44 +00:00
|
|
|
import I18n from '../../i18n';
|
2022-03-29 18:53:27 +00:00
|
|
|
import { useTheme } from '../../theme';
|
2020-10-30 13:59:44 +00:00
|
|
|
import { PADDING_HORIZONTAL } from './constants';
|
|
|
|
|
|
|
|
const styles = StyleSheet.create({
|
|
|
|
container: {
|
|
|
|
paddingBottom: 12,
|
|
|
|
paddingHorizontal: PADDING_HORIZONTAL
|
|
|
|
},
|
|
|
|
title: {
|
|
|
|
fontSize: 16,
|
|
|
|
...sharedStyles.textRegular
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-10-01 18:12:19 +00:00
|
|
|
interface IListHeader {
|
|
|
|
title: string;
|
2022-01-24 20:12:25 +00:00
|
|
|
translateTitle?: boolean;
|
2021-10-01 18:12:19 +00:00
|
|
|
}
|
|
|
|
|
2022-03-29 18:53:27 +00:00
|
|
|
const ListHeader = React.memo(({ title, translateTitle = true }: IListHeader) => {
|
|
|
|
const { theme } = useTheme();
|
|
|
|
|
|
|
|
return (
|
|
|
|
<View style={styles.container}>
|
|
|
|
<Text style={[styles.title, { color: themes[theme].infoText }]} numberOfLines={1}>
|
|
|
|
{translateTitle ? I18n.t(title) : title}
|
|
|
|
</Text>
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
});
|
2020-10-30 13:59:44 +00:00
|
|
|
|
|
|
|
ListHeader.displayName = 'List.Header';
|
|
|
|
|
2022-03-29 18:53:27 +00:00
|
|
|
export default ListHeader;
|