2020-10-30 13:59:44 +00:00
|
|
|
import React from 'react';
|
2021-09-13 20:41:05 +00:00
|
|
|
import { StyleSheet, Text, View } from 'react-native';
|
2020-10-30 13:59:44 +00:00
|
|
|
|
|
|
|
import sharedStyles from '../../views/Styles';
|
2022-04-07 14:10:03 +00:00
|
|
|
import { themes } from '../../lib/constants';
|
2020-10-30 13:59:44 +00:00
|
|
|
import I18n from '../../i18n';
|
2022-03-17 19:25:31 +00:00
|
|
|
import { useTheme } from '../../theme';
|
2020-10-30 13:59:44 +00:00
|
|
|
import { PADDING_HORIZONTAL } from './constants';
|
|
|
|
|
|
|
|
const styles = StyleSheet.create({
|
|
|
|
container: {
|
2022-09-19 18:14:05 +00:00
|
|
|
paddingVertical: 8,
|
2020-10-30 13:59:44 +00:00
|
|
|
paddingHorizontal: PADDING_HORIZONTAL
|
|
|
|
},
|
|
|
|
title: {
|
|
|
|
fontSize: 16,
|
|
|
|
...sharedStyles.textRegular
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
interface IListHeader {
|
|
|
|
title: string;
|
2022-01-17 16:10:39 +00:00
|
|
|
translateTitle?: boolean;
|
2021-09-13 20:41:05 +00:00
|
|
|
}
|
|
|
|
|
2022-03-17 19:25:31 +00:00
|
|
|
const ListHeader = React.memo(({ title, translateTitle = true }: IListHeader) => {
|
|
|
|
const { theme } = useTheme();
|
2022-03-25 18:09:02 +00:00
|
|
|
|
2022-03-17 19:25:31 +00:00
|
|
|
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-17 19:25:31 +00:00
|
|
|
export default ListHeader;
|