2020-10-30 17:35:07 +00:00
|
|
|
import React from 'react';
|
2021-09-13 20:41:05 +00:00
|
|
|
import { StyleSheet, Text, View } from 'react-native';
|
2020-10-30 17:35:07 +00:00
|
|
|
|
2022-05-07 02:34:58 +00:00
|
|
|
import { useTheme } from '../../../theme';
|
2020-10-30 17:35:07 +00:00
|
|
|
import Touch from '../../../utils/touch';
|
2022-05-02 19:21:15 +00:00
|
|
|
import { CustomIcon, TIconsName } from '../../../containers/CustomIcon';
|
2020-10-30 17:35:07 +00:00
|
|
|
import sharedStyles from '../../Styles';
|
|
|
|
|
|
|
|
const styles = StyleSheet.create({
|
|
|
|
container: {
|
|
|
|
paddingVertical: 8,
|
|
|
|
minHeight: 40,
|
|
|
|
paddingHorizontal: 16,
|
|
|
|
flexDirection: 'row',
|
|
|
|
alignItems: 'center'
|
|
|
|
},
|
|
|
|
text: {
|
|
|
|
flex: 1,
|
|
|
|
fontSize: 16,
|
|
|
|
...sharedStyles.textRegular
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2022-01-12 13:53:06 +00:00
|
|
|
interface IDropdownItem {
|
|
|
|
text: string;
|
2022-05-02 19:21:15 +00:00
|
|
|
iconName: TIconsName | null;
|
2022-01-12 13:53:06 +00:00
|
|
|
onPress: () => void;
|
|
|
|
}
|
|
|
|
|
2022-05-07 02:34:58 +00:00
|
|
|
const DropdownItem = React.memo(({ onPress, iconName, text }: IDropdownItem) => {
|
|
|
|
const { colors, theme } = useTheme();
|
|
|
|
return (
|
|
|
|
<Touch theme={theme} onPress={onPress} style={{ backgroundColor: colors.backgroundColor }}>
|
|
|
|
<View style={styles.container}>
|
|
|
|
<Text style={[styles.text, { color: colors.auxiliaryText }]}>{text}</Text>
|
|
|
|
{iconName ? <CustomIcon name={iconName} size={22} color={colors.auxiliaryText} /> : null}
|
|
|
|
</View>
|
|
|
|
</Touch>
|
|
|
|
);
|
|
|
|
});
|
2020-10-30 17:35:07 +00:00
|
|
|
|
2022-05-07 02:34:58 +00:00
|
|
|
export default DropdownItem;
|