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
|
|
|
|
|
|
|
import { themes } from '../../../constants/colors';
|
|
|
|
import { withTheme } from '../../../theme';
|
|
|
|
import Touch from '../../../utils/touch';
|
|
|
|
import { CustomIcon } from '../../../lib/Icons';
|
|
|
|
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-01-17 16:10:39 +00:00
|
|
|
iconName: string | null;
|
|
|
|
theme?: string;
|
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);
|