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-04-07 14:10:03 +00:00
|
|
|
import { themes } from '../../../lib/constants';
|
2022-04-12 16:27:05 +00:00
|
|
|
import { TSupportedThemes, withTheme } 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-04-12 16:27:05 +00:00
|
|
|
theme?: TSupportedThemes;
|
2022-01-12 13:53:06 +00:00
|
|
|
onPress: () => void;
|
|
|
|
}
|
|
|
|
|
|
|
|
const DropdownItem = React.memo(({ theme, onPress, iconName, text }: IDropdownItem) => (
|
2022-01-17 16:10:39 +00:00
|
|
|
<Touch theme={theme!} onPress={onPress} style={{ backgroundColor: themes[theme!].backgroundColor }}>
|
2020-10-30 17:35:07 +00:00
|
|
|
<View style={styles.container}>
|
2022-01-17 16:10:39 +00:00
|
|
|
<Text style={[styles.text, { color: themes[theme!].auxiliaryText }]}>{text}</Text>
|
|
|
|
{iconName ? <CustomIcon name={iconName} size={22} color={themes[theme!].auxiliaryText} /> : null}
|
2020-10-30 17:35:07 +00:00
|
|
|
</View>
|
|
|
|
</Touch>
|
|
|
|
));
|
|
|
|
|
|
|
|
export default withTheme(DropdownItem);
|