-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathindex.tsx
More file actions
59 lines (54 loc) · 1.6 KB
/
Copy pathindex.tsx
File metadata and controls
59 lines (54 loc) · 1.6 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
import { FC } from 'react';
import { StyleSheet, TouchableNativeFeedback, View } from 'react-native';
import { Button as RNEButton } from 'react-native-elements';
import { ButtonProps } from '@/components/button/type';
import useVisualScheme from '@/store/visualScheme';
import { commonColors } from '@/styles/common';
const Button: FC<ButtonProps> = ({
isLoading = false,
onPress,
text_style,
style,
children,
}) => {
const currentStyle = useVisualScheme(state => state.currentStyle);
const btnGlobalStyle = currentStyle?.button_style ?? {};
const textGlobalStyle = currentStyle?.button_text_style ?? {};
const ripplePurple = commonColors.lightPurple ?? '#B8A6F5';
return (
<TouchableNativeFeedback
background={TouchableNativeFeedback.Ripple(ripplePurple, false)}
disabled={isLoading}
onPress={() => onPress?.(true)}
>
<View
style={[styles.rect_button, { opacity: isLoading ? 0.4 : 1 }, style]}
>
<RNEButton
activeOpacity={1}
containerStyle={[btnGlobalStyle]}
buttonStyle={styles.button}
titleStyle={[textGlobalStyle, text_style]}
loading={isLoading}
loadingProps={{ color: '#fff', style: { marginRight: 5 } }}
title={children}
accessibilityRole="button"
/>
</View>
</TouchableNativeFeedback>
);
};
const styles = StyleSheet.create({
rect_button: {
width: 200,
height: 40,
overflow: 'hidden',
},
button: {
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'center',
borderRadius: 6,
},
});
export default Button;