2021-10-01 18:12:19 +00:00
|
|
|
import React from 'react';
|
2022-01-24 20:12:25 +00:00
|
|
|
import { StyleProp, StyleSheet, View, ViewStyle } from 'react-native';
|
2021-10-01 18:12:19 +00:00
|
|
|
|
2022-04-28 18:44:40 +00:00
|
|
|
import { themes } from '../../lib/constants';
|
2022-05-30 22:01:25 +00:00
|
|
|
import { CustomIcon, TIconsName } from '../CustomIcon';
|
2022-03-29 18:53:27 +00:00
|
|
|
import { useTheme } from '../../theme';
|
2021-10-01 18:12:19 +00:00
|
|
|
import { ICON_SIZE } from './constants';
|
|
|
|
|
|
|
|
interface IListIcon {
|
2022-05-30 22:01:25 +00:00
|
|
|
name: TIconsName;
|
2022-04-28 18:44:40 +00:00
|
|
|
color?: string | null;
|
2022-01-24 20:12:25 +00:00
|
|
|
style?: StyleProp<ViewStyle>;
|
|
|
|
testID?: string;
|
2022-04-28 18:44:40 +00:00
|
|
|
size?: number;
|
2021-10-01 18:12:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const styles = StyleSheet.create({
|
|
|
|
icon: {
|
|
|
|
alignItems: 'center',
|
|
|
|
justifyContent: 'center'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2022-04-28 18:44:40 +00:00
|
|
|
const ListIcon = React.memo(({ name, color, style, testID, size }: IListIcon) => {
|
2022-03-29 18:53:27 +00:00
|
|
|
const { theme } = useTheme();
|
|
|
|
|
|
|
|
return (
|
|
|
|
<View style={[styles.icon, style]}>
|
2022-04-28 18:44:40 +00:00
|
|
|
<CustomIcon name={name} color={color ?? themes[theme].auxiliaryText} size={size ?? ICON_SIZE} testID={testID} />
|
2022-03-29 18:53:27 +00:00
|
|
|
</View>
|
|
|
|
);
|
|
|
|
});
|
2021-10-01 18:12:19 +00:00
|
|
|
|
|
|
|
ListIcon.displayName = 'List.Icon';
|
|
|
|
|
2022-03-29 18:53:27 +00:00
|
|
|
export default ListIcon;
|