rn-vs-lb 1.0.70 → 1.0.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -13,6 +13,8 @@ const meta: Meta = {
|
|
|
13
13
|
onBackPress: { action: 'back' },
|
|
14
14
|
children: { control: false },
|
|
15
15
|
infoTooltip: { control: false },
|
|
16
|
+
customBackButton: { control: false },
|
|
17
|
+
background: { control: 'color' },
|
|
16
18
|
},
|
|
17
19
|
};
|
|
18
20
|
|
|
@@ -77,3 +79,23 @@ WithInfoTooltip.render = (args) => (
|
|
|
77
79
|
/>
|
|
78
80
|
</View>
|
|
79
81
|
);
|
|
82
|
+
|
|
83
|
+
export const WithCustomBackButton = Template.bind({});
|
|
84
|
+
WithCustomBackButton.args = {
|
|
85
|
+
background: '#EAF5FF',
|
|
86
|
+
};
|
|
87
|
+
WithCustomBackButton.render = (args) => (
|
|
88
|
+
<View style={{ padding: 16, backgroundColor: '#f8f8f8' }}>
|
|
89
|
+
<HeaderDefault
|
|
90
|
+
{...args}
|
|
91
|
+
customBackButton={(
|
|
92
|
+
<TouchableOpacity
|
|
93
|
+
onPress={args.onBackPress}
|
|
94
|
+
style={{ backgroundColor: '#D7E9FF', borderRadius: 12, paddingHorizontal: 10, paddingVertical: 6 }}
|
|
95
|
+
>
|
|
96
|
+
<Text style={{ fontSize: 12, fontWeight: '600' }}>{'< Back'}</Text>
|
|
97
|
+
</TouchableOpacity>
|
|
98
|
+
)}
|
|
99
|
+
/>
|
|
100
|
+
</View>
|
|
101
|
+
);
|
|
@@ -12,21 +12,35 @@ export enum AccessType {
|
|
|
12
12
|
|
|
13
13
|
interface HeaderProps {
|
|
14
14
|
title: string;
|
|
15
|
-
onBackPress
|
|
15
|
+
onBackPress?: () => void;
|
|
16
16
|
acceessType?: AccessType;
|
|
17
17
|
children?: React.ReactNode;
|
|
18
18
|
infoTooltip?: React.ReactNode;
|
|
19
|
+
background?: string;
|
|
20
|
+
customBackButton?: React.ReactNode;
|
|
19
21
|
}
|
|
20
22
|
|
|
21
|
-
const HeaderDefault: React.FC<HeaderProps> = ({
|
|
23
|
+
const HeaderDefault: React.FC<HeaderProps> = ({
|
|
24
|
+
title,
|
|
25
|
+
onBackPress,
|
|
26
|
+
children,
|
|
27
|
+
acceessType,
|
|
28
|
+
infoTooltip,
|
|
29
|
+
background,
|
|
30
|
+
customBackButton,
|
|
31
|
+
}) => {
|
|
22
32
|
const { globalStyleSheet, theme, sizes, commonStyles, typography } = useTheme();
|
|
23
33
|
const styles = getStyles({ globalStyleSheet, theme, sizes, commonStyles });
|
|
24
34
|
|
|
25
35
|
return (
|
|
26
|
-
<View style={styles.container}>
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
36
|
+
<View style={[styles.container, background ? { backgroundColor: background } : undefined]}>
|
|
37
|
+
{customBackButton ? (
|
|
38
|
+
customBackButton
|
|
39
|
+
) : (
|
|
40
|
+
<TouchableOpacity onPress={onBackPress}>
|
|
41
|
+
<Ionicons name="arrow-back" size={25} color={theme.text} />
|
|
42
|
+
</TouchableOpacity>
|
|
43
|
+
)}
|
|
30
44
|
<View style={[styles.titleContainer, !children && { paddingRight: sizes.xl }]}>
|
|
31
45
|
<Text style={typography.titleH5}>{title}</Text>
|
|
32
46
|
{acceessType && acceessType !== AccessType.COMMON && <Text style={styles.access}>{'\u2014'} {acceessType}</Text>}
|