-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathButtonMenu.js
More file actions
62 lines (58 loc) · 1.52 KB
/
Copy pathButtonMenu.js
File metadata and controls
62 lines (58 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import React from 'react';
import { Text, View, Pressable } from 'react-native';
import Icon from 'react-native-vector-icons/FontAwesome';
import { ThemeContext } from '~/contexts/theme';
import settingStyles from '~/styles/settings';
import size from '~/styles/size';
import mainStyles from '~/styles/main';
const ButtonMenu = ({ title, onPress, onLongPress = () => {}, icon, endText = "", isLast = false }) => {
const theme = React.useContext(ThemeContext)
return (
<Pressable
style={({ pressed }) => ([mainStyles.opacity({ pressed }), settingStyles.optionItem(theme, isLast)])}
onPress={onPress}
onLongPress={onLongPress}
>
<View
style={{
height: '60%',
aspectRatio: 1,
marginRight: 15,
backgroundColor: theme.primaryTouch,
borderRadius: 5,
alignItems: 'center',
justifyContent: 'center',
}}>
<Icon
name={icon}
size={18}
color={theme.innerTouch}
/>
</View>
<Text
numberOfLines={1}
style={[settingStyles.primaryText(theme), { flex: 1 }]}>{title}</Text>
{
endText ?
<Text
numberOfLines={1}
style={{
flex: 1,
textAlign: 'right',
color: theme.secondaryText,
fontSize: size.text.medium,
overflow: 'hidden',
}}>
{endText}
</Text> : null
}
<Icon
name="angle-right"
size={size.icon.tiny}
style={{ marginStart: 10 }}
color={theme.secondaryText}
/>
</Pressable>
)
}
export default ButtonMenu;