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';
|
|
|
|
import { withTheme } from '../../theme';
|
|
|
|
import { ICON_SIZE } from './constants';
|
|
|
|
|
|
|
|
interface IListIcon {
|
2022-01-17 16:10:39 +00:00
|
|
|
theme?: string;
|
2021-09-13 20:41:05 +00:00
|
|
|
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'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
const ListIcon = React.memo(({ theme, name, color, style, testID }: IListIcon) => (
|
|
|
|
<View style={[styles.icon, style]}>
|
2022-01-17 16:10:39 +00:00
|
|
|
<CustomIcon name={name} color={color ?? themes[theme!].auxiliaryText} size={ICON_SIZE} testID={testID} />
|
2021-09-13 20:41:05 +00:00
|
|
|
</View>
|
|
|
|
));
|
|
|
|
|
|
|
|
ListIcon.displayName = 'List.Icon';
|
|
|
|
|
|
|
|
export default withTheme(ListIcon);
|