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
|
|
|
|
|
|
|
import { themes } from '../../constants/colors';
|
|
|
|
import { CustomIcon } from '../../lib/Icons';
|
|
|
|
import { withTheme } from '../../theme';
|
|
|
|
import { ICON_SIZE } from './constants';
|
|
|
|
|
|
|
|
interface IListIcon {
|
2022-01-24 20:12:25 +00:00
|
|
|
theme?: string;
|
2021-10-01 18:12:19 +00:00
|
|
|
name: string;
|
2022-01-24 20:12:25 +00:00
|
|
|
color?: string;
|
|
|
|
style?: StyleProp<ViewStyle>;
|
|
|
|
testID?: string;
|
2021-10-01 18:12:19 +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-24 20:12:25 +00:00
|
|
|
<CustomIcon name={name} color={color ?? themes[theme!].auxiliaryText} size={ICON_SIZE} testID={testID} />
|
2021-10-01 18:12:19 +00:00
|
|
|
</View>
|
|
|
|
));
|
|
|
|
|
|
|
|
ListIcon.displayName = 'List.Icon';
|
|
|
|
|
|
|
|
export default withTheme(ListIcon);
|