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
|
|
|
|
2022-04-07 14:10:03 +00:00
|
|
|
import { themes } from '../../lib/constants';
|
2021-09-13 20:41:05 +00:00
|
|
|
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-04-12 16:27:05 +00:00
|
|
|
color?: string | null;
|
2022-01-17 16:10:39 +00:00
|
|
|
style?: StyleProp<ViewStyle>;
|
|
|
|
testID?: string;
|
2022-04-15 03:11:36 +00:00
|
|
|
size?: number;
|
2021-09-13 20:41:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const styles = StyleSheet.create({
|
|
|
|
icon: {
|
|
|
|
alignItems: 'center',
|
|
|
|
justifyContent: 'center'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2022-04-15 03:11:36 +00:00
|
|
|
const ListIcon = React.memo(({ name, color, style, testID, size }: IListIcon) => {
|
2022-03-25 18:09:02 +00:00
|
|
|
const { theme } = useTheme();
|
|
|
|
|
|
|
|
return (
|
|
|
|
<View style={[styles.icon, style]}>
|
2022-04-15 03:11:36 +00:00
|
|
|
<CustomIcon name={name} color={color ?? themes[theme].auxiliaryText} size={size ?? ICON_SIZE} testID={testID} />
|
2022-03-25 18:09:02 +00:00
|
|
|
</View>
|
|
|
|
);
|
|
|
|
});
|
2021-09-13 20:41:05 +00:00
|
|
|
|
|
|
|
ListIcon.displayName = 'List.Icon';
|
|
|
|
|
2022-03-25 18:09:02 +00:00
|
|
|
export default ListIcon;
|