2021-09-13 20:41:05 +00:00
|
|
|
import React from 'react';
|
2022-01-17 16:10:39 +00:00
|
|
|
import { StyleProp, StyleSheet, View, ViewStyle } from 'react-native';
|
2021-09-13 20:41:05 +00:00
|
|
|
|
|
|
|
import { themes } from '../../constants/colors';
|
|
|
|
import { CustomIcon } from '../../lib/Icons';
|
2022-03-25 18:09:02 +00:00
|
|
|
import { useTheme } from '../../theme';
|
2021-09-13 20:41:05 +00:00
|
|
|
import { ICON_SIZE } from './constants';
|
|
|
|
|
|
|
|
interface IListIcon {
|
|
|
|
name: string;
|
2022-01-17 16:10:39 +00:00
|
|
|
color?: string;
|
|
|
|
style?: StyleProp<ViewStyle>;
|
|
|
|
testID?: string;
|
2021-09-13 20:41:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const styles = StyleSheet.create({
|
|
|
|
icon: {
|
|
|
|
alignItems: 'center',
|
|
|
|
justifyContent: 'center'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2022-03-25 18:09:02 +00:00
|
|
|
const ListIcon = React.memo(({ name, color, style, testID }: IListIcon) => {
|
|
|
|
const { theme } = useTheme();
|
|
|
|
|
|
|
|
return (
|
|
|
|
<View style={[styles.icon, style]}>
|
|
|
|
<CustomIcon name={name} color={color ?? themes[theme].auxiliaryText} size={ICON_SIZE} testID={testID} />
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
});
|
2021-09-13 20:41:05 +00:00
|
|
|
|
|
|
|
ListIcon.displayName = 'List.Icon';
|
|
|
|
|
2022-03-25 18:09:02 +00:00
|
|
|
export default ListIcon;
|