2022-02-04 22:15:01 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { StyleSheet, Text, View } from 'react-native';
|
|
|
|
|
2022-04-07 14:10:03 +00:00
|
|
|
import { themes } from '../../../lib/constants';
|
2022-02-04 22:15:01 +00:00
|
|
|
import { useTheme } from '../../../theme';
|
2022-08-17 13:32:21 +00:00
|
|
|
import Touch from '../../../containers/Touch';
|
2022-05-02 19:21:15 +00:00
|
|
|
import { CustomIcon, TIconsName } from '../../../containers/CustomIcon';
|
2022-02-04 22:15:01 +00:00
|
|
|
import sharedStyles from '../../Styles';
|
|
|
|
|
|
|
|
export const ROW_HEIGHT = 44;
|
|
|
|
|
|
|
|
const styles = StyleSheet.create({
|
|
|
|
container: {
|
|
|
|
paddingVertical: 11,
|
|
|
|
height: ROW_HEIGHT,
|
|
|
|
paddingHorizontal: 16,
|
|
|
|
flexDirection: 'row',
|
|
|
|
alignItems: 'center'
|
|
|
|
},
|
|
|
|
text: {
|
|
|
|
flex: 1,
|
|
|
|
fontSize: 16,
|
|
|
|
...sharedStyles.textRegular
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
interface IDropdownItem {
|
|
|
|
text: string;
|
2022-05-02 19:21:15 +00:00
|
|
|
iconName: TIconsName | null;
|
2022-02-04 22:15:01 +00:00
|
|
|
onPress: () => void;
|
|
|
|
}
|
|
|
|
|
|
|
|
const DropdownItem = React.memo(({ onPress, iconName, text }: IDropdownItem) => {
|
|
|
|
const { theme } = useTheme();
|
|
|
|
|
|
|
|
return (
|
2024-04-18 10:19:54 +00:00
|
|
|
<Touch onPress={onPress} style={{ backgroundColor: themes[theme].surfaceRoom }}>
|
2022-02-04 22:15:01 +00:00
|
|
|
<View style={styles.container}>
|
2024-04-18 10:19:54 +00:00
|
|
|
<Text style={[styles.text, { color: themes[theme].fontSecondaryInfo }]}>{text}</Text>
|
|
|
|
{iconName ? <CustomIcon name={iconName} size={22} color={themes[theme].fontSecondaryInfo} /> : null}
|
2022-02-04 22:15:01 +00:00
|
|
|
</View>
|
|
|
|
</Touch>
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
export default DropdownItem;
|