@momo-kits/foundation 1.0.8 → 1.0.10
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.
- package/Consts/styles.ts +0 -59
- package/Consts/theme.ts +4 -4
- package/Input/Input.tsx +3 -0
- package/Input/MoneyInput.tsx +151 -0
- package/Input/SearchInput.tsx +28 -30
- package/Input/TextArea.tsx +4 -1
- package/Input/common.tsx +7 -0
- package/Input/index.tsx +13 -6
- package/Input/styles.ts +9 -4
- package/Navigation/Components.tsx +119 -11
- package/Navigation/ModalScreen.tsx +67 -66
- package/Navigation/NavigationButton.tsx +20 -5
- package/Navigation/Navigator.ts +2 -2
- package/Navigation/types.ts +8 -2
- package/Navigation/utils.tsx +16 -26
- package/Popup/PopupNotify.tsx +4 -1
- package/Text/index.tsx +19 -1
- package/package.json +1 -1
package/Consts/styles.ts
CHANGED
|
@@ -47,38 +47,6 @@ const Styles = StyleSheet.create({
|
|
|
47
47
|
alignItems: 'flex-end',
|
|
48
48
|
justifyContent: 'center',
|
|
49
49
|
},
|
|
50
|
-
//padding
|
|
51
|
-
padding4: {
|
|
52
|
-
padding: 4,
|
|
53
|
-
},
|
|
54
|
-
padding8: {
|
|
55
|
-
padding: 8,
|
|
56
|
-
},
|
|
57
|
-
padding16: {
|
|
58
|
-
padding: 16,
|
|
59
|
-
},
|
|
60
|
-
padding24: {
|
|
61
|
-
padding: 24,
|
|
62
|
-
},
|
|
63
|
-
padding32: {
|
|
64
|
-
padding: 32,
|
|
65
|
-
},
|
|
66
|
-
//margin
|
|
67
|
-
margin4: {
|
|
68
|
-
margin: 4,
|
|
69
|
-
},
|
|
70
|
-
margin8: {
|
|
71
|
-
margin: 8,
|
|
72
|
-
},
|
|
73
|
-
margin16: {
|
|
74
|
-
margin: 16,
|
|
75
|
-
},
|
|
76
|
-
margin24: {
|
|
77
|
-
margin: 24,
|
|
78
|
-
},
|
|
79
|
-
margin32: {
|
|
80
|
-
margin: 32,
|
|
81
|
-
},
|
|
82
50
|
//paddingHorizontal
|
|
83
51
|
paddingHorizontal4: {
|
|
84
52
|
paddingHorizontal: 4,
|
|
@@ -105,33 +73,6 @@ const Styles = StyleSheet.create({
|
|
|
105
73
|
paddingVertical24: {
|
|
106
74
|
paddingVertical: 24,
|
|
107
75
|
},
|
|
108
|
-
//button
|
|
109
|
-
buttonContent: {
|
|
110
|
-
paddingHorizontal: 16,
|
|
111
|
-
paddingVertical: 8,
|
|
112
|
-
flexDirection: 'row',
|
|
113
|
-
},
|
|
114
|
-
|
|
115
|
-
headerRightButton: {
|
|
116
|
-
flexDirection: 'row',
|
|
117
|
-
overflow: 'hidden',
|
|
118
|
-
justifyContent: 'center',
|
|
119
|
-
alignItems: 'center',
|
|
120
|
-
paddingHorizontal: 4,
|
|
121
|
-
},
|
|
122
|
-
//text
|
|
123
|
-
textCenter: {textAlign: 'center'},
|
|
124
|
-
//card
|
|
125
|
-
card: {
|
|
126
|
-
shadowColor: 'gray',
|
|
127
|
-
shadowOffset: {
|
|
128
|
-
width: 1,
|
|
129
|
-
height: 1,
|
|
130
|
-
},
|
|
131
|
-
shadowOpacity: 0.3,
|
|
132
|
-
shadowRadius: 4,
|
|
133
|
-
elevation: 4,
|
|
134
|
-
},
|
|
135
76
|
});
|
|
136
77
|
|
|
137
78
|
export {Styles};
|
package/Consts/theme.ts
CHANGED
|
@@ -60,14 +60,14 @@ const defaultTheme: Theme = {
|
|
|
60
60
|
const defaultDarkTheme: Theme = {
|
|
61
61
|
dark: true,
|
|
62
62
|
colors: {
|
|
63
|
-
primary:
|
|
64
|
-
secondary:
|
|
63
|
+
primary: Colors.pink_04,
|
|
64
|
+
secondary: Colors.pink_08,
|
|
65
65
|
background: {
|
|
66
66
|
default: '#121212', // Dark background
|
|
67
67
|
surface: '#1e1e1e', // Slightly lighter surface background
|
|
68
|
-
tonal:
|
|
68
|
+
tonal: Colors.pink_10,
|
|
69
69
|
pressed: '#1a1a1a', // Pressed state background
|
|
70
|
-
selected:
|
|
70
|
+
selected: Colors.pink_11,
|
|
71
71
|
disable: '#303030', // Disabled state background
|
|
72
72
|
},
|
|
73
73
|
text: {
|
package/Input/Input.tsx
CHANGED
|
@@ -27,6 +27,7 @@ const Input: FC<InputProps> = ({
|
|
|
27
27
|
disabled,
|
|
28
28
|
floatingIconColor,
|
|
29
29
|
iconColor,
|
|
30
|
+
required,
|
|
30
31
|
...props
|
|
31
32
|
}) => {
|
|
32
33
|
const {theme} = useContext(ApplicationContext);
|
|
@@ -81,6 +82,7 @@ const Input: FC<InputProps> = ({
|
|
|
81
82
|
floatingValue={floatingValue}
|
|
82
83
|
floatingIconColor={floatingIconColor}
|
|
83
84
|
disabled={disabled}
|
|
85
|
+
required={required}
|
|
84
86
|
floatingIcon={floatingIcon}
|
|
85
87
|
/>
|
|
86
88
|
<View style={styles.inputView}>
|
|
@@ -95,6 +97,7 @@ const Input: FC<InputProps> = ({
|
|
|
95
97
|
color: textColor,
|
|
96
98
|
},
|
|
97
99
|
]}
|
|
100
|
+
textBreakStrategy="highQuality"
|
|
98
101
|
value={value}
|
|
99
102
|
onChangeText={_onChangeText}
|
|
100
103
|
onFocus={_onFocus}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import React, {FC, useContext, useRef, useState} from 'react';
|
|
2
|
+
import {
|
|
3
|
+
NativeSyntheticEvent,
|
|
4
|
+
TextInput,
|
|
5
|
+
TextInputFocusEventData,
|
|
6
|
+
TouchableOpacity,
|
|
7
|
+
View,
|
|
8
|
+
} from 'react-native';
|
|
9
|
+
import {ApplicationContext} from '../Navigation';
|
|
10
|
+
import styles from './styles';
|
|
11
|
+
import {Image} from '../Image';
|
|
12
|
+
import {ErrorView, FloatingView, getBorderColor} from './common';
|
|
13
|
+
import {MoneyInputProps} from './index';
|
|
14
|
+
import {Icon} from '../Icon';
|
|
15
|
+
|
|
16
|
+
const MoneyInput: FC<MoneyInputProps> = ({
|
|
17
|
+
onChangeText,
|
|
18
|
+
floatingValue,
|
|
19
|
+
floatingIcon,
|
|
20
|
+
size,
|
|
21
|
+
onBlur,
|
|
22
|
+
onFocus,
|
|
23
|
+
errorMessage,
|
|
24
|
+
icon,
|
|
25
|
+
disabled,
|
|
26
|
+
floatingIconColor,
|
|
27
|
+
iconColor,
|
|
28
|
+
required,
|
|
29
|
+
...props
|
|
30
|
+
}) => {
|
|
31
|
+
const {theme} = useContext(ApplicationContext);
|
|
32
|
+
const [focused, setFocused] = useState(false);
|
|
33
|
+
const [value, setValue] = useState('');
|
|
34
|
+
const inputRef = useRef<any>(null);
|
|
35
|
+
|
|
36
|
+
const onClearText = () => {
|
|
37
|
+
inputRef?.current?.clear();
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const formatNumberWithDots = (num: string) => {
|
|
41
|
+
return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, '.');
|
|
42
|
+
};
|
|
43
|
+
const _onChangeText = (text: string) => {
|
|
44
|
+
let numericValue = text.replace(/[^0-9]/g, '');
|
|
45
|
+
if (numericValue === '') numericValue = '0';
|
|
46
|
+
const formattedNumber = formatNumberWithDots(numericValue);
|
|
47
|
+
const formattedValue = `${formattedNumber}đ`;
|
|
48
|
+
onChangeText?.(formattedValue);
|
|
49
|
+
setValue(formattedValue);
|
|
50
|
+
};
|
|
51
|
+
const getSizeStyle = () => {
|
|
52
|
+
if (size === 'small') {
|
|
53
|
+
return styles.smallContainer;
|
|
54
|
+
}
|
|
55
|
+
return styles.container;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const _onFocus = (e: NativeSyntheticEvent<TextInputFocusEventData>) => {
|
|
59
|
+
setFocused(true);
|
|
60
|
+
onFocus?.(e);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const _onBlur = (e: NativeSyntheticEvent<TextInputFocusEventData>) => {
|
|
64
|
+
setFocused(false);
|
|
65
|
+
onBlur?.(e);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const renderInputView = () => {
|
|
69
|
+
const disabledColor = theme.colors.text.disable;
|
|
70
|
+
let textColor = theme.colors.text.default;
|
|
71
|
+
let placeholderColor = theme.colors.text.hint;
|
|
72
|
+
let iconTintColor = iconColor;
|
|
73
|
+
|
|
74
|
+
if (disabled) {
|
|
75
|
+
textColor = disabledColor;
|
|
76
|
+
placeholderColor = disabledColor;
|
|
77
|
+
iconTintColor = disabledColor;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<View
|
|
82
|
+
style={[
|
|
83
|
+
getSizeStyle(),
|
|
84
|
+
getBorderColor(focused, errorMessage, disabled),
|
|
85
|
+
styles.inputWrapper,
|
|
86
|
+
{backgroundColor: theme.colors.background.surface},
|
|
87
|
+
]}>
|
|
88
|
+
<FloatingView
|
|
89
|
+
floatingValue={floatingValue}
|
|
90
|
+
floatingIconColor={floatingIconColor}
|
|
91
|
+
disabled={disabled}
|
|
92
|
+
required={required}
|
|
93
|
+
floatingIcon={floatingIcon}
|
|
94
|
+
/>
|
|
95
|
+
<View style={styles.inputView}>
|
|
96
|
+
<TextInput
|
|
97
|
+
{...props}
|
|
98
|
+
editable={!disabled}
|
|
99
|
+
textAlignVertical="top"
|
|
100
|
+
ref={inputRef}
|
|
101
|
+
keyboardType={'number-pad'}
|
|
102
|
+
style={[
|
|
103
|
+
styles.moneyInput,
|
|
104
|
+
{
|
|
105
|
+
color: textColor,
|
|
106
|
+
},
|
|
107
|
+
]}
|
|
108
|
+
value={value}
|
|
109
|
+
onChangeText={_onChangeText}
|
|
110
|
+
onFocus={_onFocus}
|
|
111
|
+
onBlur={_onBlur}
|
|
112
|
+
selectionColor={theme.colors.primary}
|
|
113
|
+
placeholderTextColor={placeholderColor}
|
|
114
|
+
placeholder={'0đ'}
|
|
115
|
+
/>
|
|
116
|
+
</View>
|
|
117
|
+
<View style={styles.iconView}>
|
|
118
|
+
{focused && (
|
|
119
|
+
<TouchableOpacity style={styles.iconWrapper} onPress={onClearText}>
|
|
120
|
+
<Icon
|
|
121
|
+
source="24_navigation_close_circle_full"
|
|
122
|
+
size={16}
|
|
123
|
+
color={theme.colors.text.hint}
|
|
124
|
+
/>
|
|
125
|
+
</TouchableOpacity>
|
|
126
|
+
)}
|
|
127
|
+
{icon && (
|
|
128
|
+
<Image
|
|
129
|
+
tintColor={iconTintColor}
|
|
130
|
+
source={{uri: icon}}
|
|
131
|
+
style={styles.icon}
|
|
132
|
+
/>
|
|
133
|
+
)}
|
|
134
|
+
</View>
|
|
135
|
+
</View>
|
|
136
|
+
);
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
return (
|
|
140
|
+
<View style={styles.wrapper}>
|
|
141
|
+
{renderInputView()}
|
|
142
|
+
<ErrorView errorMessage={errorMessage} />
|
|
143
|
+
</View>
|
|
144
|
+
);
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
MoneyInput.defaultProps = {
|
|
148
|
+
size: 'small',
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
export default MoneyInput;
|
package/Input/SearchInput.tsx
CHANGED
|
@@ -25,8 +25,9 @@ const SearchInput: FC<SearchInputProps> = ({
|
|
|
25
25
|
onChangeText,
|
|
26
26
|
icon,
|
|
27
27
|
buttonText = 'Hủy',
|
|
28
|
-
showButtonText,
|
|
28
|
+
showButtonText = true,
|
|
29
29
|
showIcon = true,
|
|
30
|
+
style,
|
|
30
31
|
...props
|
|
31
32
|
}) => {
|
|
32
33
|
const {theme} = useContext(ApplicationContext);
|
|
@@ -63,32 +64,25 @@ const SearchInput: FC<SearchInputProps> = ({
|
|
|
63
64
|
iconTintColor = disabledColor;
|
|
64
65
|
}
|
|
65
66
|
return (
|
|
66
|
-
<
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
{
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
onFocus={_onFocus}
|
|
86
|
-
onBlur={_onBlur}
|
|
87
|
-
placeholder={placeholder}
|
|
88
|
-
selectionColor={theme.colors.primary}
|
|
89
|
-
placeholderTextColor={placeholderColor}
|
|
90
|
-
/>
|
|
91
|
-
</View>
|
|
67
|
+
<TextInput
|
|
68
|
+
{...props}
|
|
69
|
+
editable={!disabled}
|
|
70
|
+
textAlignVertical="top"
|
|
71
|
+
ref={inputRef}
|
|
72
|
+
style={[
|
|
73
|
+
styles.searchInput,
|
|
74
|
+
{
|
|
75
|
+
color: textColor,
|
|
76
|
+
},
|
|
77
|
+
]}
|
|
78
|
+
value={value}
|
|
79
|
+
onChangeText={_onChangeText}
|
|
80
|
+
onFocus={_onFocus}
|
|
81
|
+
onBlur={_onBlur}
|
|
82
|
+
placeholder={placeholder}
|
|
83
|
+
selectionColor={theme.colors.primary}
|
|
84
|
+
placeholderTextColor={placeholderColor}
|
|
85
|
+
/>
|
|
92
86
|
);
|
|
93
87
|
};
|
|
94
88
|
|
|
@@ -108,7 +102,7 @@ const SearchInput: FC<SearchInputProps> = ({
|
|
|
108
102
|
</TouchableOpacity>
|
|
109
103
|
)}
|
|
110
104
|
{showIcon && icon && (
|
|
111
|
-
<View>
|
|
105
|
+
<View style={{flexDirection: 'row'}}>
|
|
112
106
|
<View
|
|
113
107
|
style={[
|
|
114
108
|
styles.divider,
|
|
@@ -117,7 +111,6 @@ const SearchInput: FC<SearchInputProps> = ({
|
|
|
117
111
|
},
|
|
118
112
|
]}
|
|
119
113
|
/>
|
|
120
|
-
|
|
121
114
|
<Image
|
|
122
115
|
tintColor={iconTintColor}
|
|
123
116
|
source={{uri: icon}}
|
|
@@ -129,13 +122,18 @@ const SearchInput: FC<SearchInputProps> = ({
|
|
|
129
122
|
);
|
|
130
123
|
};
|
|
131
124
|
return (
|
|
132
|
-
<View style={styles.searchInputContainer}>
|
|
125
|
+
<View style={[style, styles.searchInputContainer]}>
|
|
133
126
|
<View
|
|
134
127
|
style={[
|
|
135
128
|
getBorderColor(focused, errorMessage, disabled),
|
|
136
129
|
styles.searchInputWrapper,
|
|
137
130
|
{backgroundColor: theme.colors.background.surface},
|
|
138
131
|
]}>
|
|
132
|
+
<Icon
|
|
133
|
+
source={'navigation_search'}
|
|
134
|
+
size={24}
|
|
135
|
+
color={theme.colors.text.hint}
|
|
136
|
+
/>
|
|
139
137
|
{renderInputView()}
|
|
140
138
|
{renderIconView()}
|
|
141
139
|
</View>
|
package/Input/TextArea.tsx
CHANGED
|
@@ -35,6 +35,7 @@ const TextArea: FC<TextAreaProps> = props => {
|
|
|
35
35
|
height,
|
|
36
36
|
placeholder,
|
|
37
37
|
maxLength,
|
|
38
|
+
required,
|
|
38
39
|
} = props;
|
|
39
40
|
|
|
40
41
|
const [focused, setFocused] = useState(false);
|
|
@@ -83,7 +84,7 @@ const TextArea: FC<TextAreaProps> = props => {
|
|
|
83
84
|
<View
|
|
84
85
|
style={[
|
|
85
86
|
getBorderColor(focused, errorMessage, disabled),
|
|
86
|
-
styles.
|
|
87
|
+
styles.textAreaWradpper,
|
|
87
88
|
{
|
|
88
89
|
height: height || DEFAULT_HEIGHT,
|
|
89
90
|
backgroundColor: theme.colors.background.surface,
|
|
@@ -94,6 +95,7 @@ const TextArea: FC<TextAreaProps> = props => {
|
|
|
94
95
|
floatingIconColor={floatingIconColor}
|
|
95
96
|
disabled={disabled}
|
|
96
97
|
floatingIcon={floatingIcon}
|
|
98
|
+
required={required}
|
|
97
99
|
/>
|
|
98
100
|
<View style={styles.rowArea}>
|
|
99
101
|
<View style={styles.textAreaView}>
|
|
@@ -108,6 +110,7 @@ const TextArea: FC<TextAreaProps> = props => {
|
|
|
108
110
|
},
|
|
109
111
|
]}
|
|
110
112
|
maxLength={maxLength}
|
|
113
|
+
textBreakStrategy="highQuality"
|
|
111
114
|
multiline={true}
|
|
112
115
|
value={value}
|
|
113
116
|
onChangeText={_onChangeText}
|
package/Input/common.tsx
CHANGED
|
@@ -11,6 +11,7 @@ type FloatingViewProps = {
|
|
|
11
11
|
floatingIconColor?: string;
|
|
12
12
|
disabled?: boolean;
|
|
13
13
|
floatingIcon?: string;
|
|
14
|
+
required?: boolean;
|
|
14
15
|
};
|
|
15
16
|
|
|
16
17
|
export const DEFAULT_HEIGHT = 112;
|
|
@@ -63,6 +64,7 @@ export const FloatingView: FC<FloatingViewProps> = ({
|
|
|
63
64
|
floatingIconColor,
|
|
64
65
|
disabled,
|
|
65
66
|
floatingIcon,
|
|
67
|
+
required,
|
|
66
68
|
}) => {
|
|
67
69
|
const {theme} = useContext(ApplicationContext);
|
|
68
70
|
|
|
@@ -85,6 +87,11 @@ export const FloatingView: FC<FloatingViewProps> = ({
|
|
|
85
87
|
]}>
|
|
86
88
|
<Text color={floatingTextColor} typography={'label_s'}>
|
|
87
89
|
{floatingValue}
|
|
90
|
+
{required && (
|
|
91
|
+
<Text typography={'label_s'} color={theme.colors.error.primary}>
|
|
92
|
+
*
|
|
93
|
+
</Text>
|
|
94
|
+
)}
|
|
88
95
|
</Text>
|
|
89
96
|
{floatingIcon && (
|
|
90
97
|
<Image
|
package/Input/index.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import Input from './Input';
|
|
2
2
|
import TextArea from './TextArea';
|
|
3
3
|
import SearchInput from './SearchInput';
|
|
4
|
+
import MoneyInput from './MoneyInput';
|
|
4
5
|
import {TextInputProps} from 'react-native';
|
|
5
6
|
|
|
6
7
|
export interface InputProps extends TextInputProps {
|
|
@@ -12,20 +13,26 @@ export interface InputProps extends TextInputProps {
|
|
|
12
13
|
disabled?: boolean;
|
|
13
14
|
floatingIconColor?: string;
|
|
14
15
|
iconColor?: string;
|
|
16
|
+
required?: boolean;
|
|
15
17
|
}
|
|
16
18
|
|
|
17
|
-
type
|
|
19
|
+
type InputPropsWithoutSizeAndIcon = Omit<
|
|
20
|
+
InputProps,
|
|
21
|
+
'size' | 'icon' | 'iconColor'
|
|
22
|
+
>;
|
|
23
|
+
type InputPropsWithoutRequiredAndSize = Omit<InputProps, 'required' | 'size'>;
|
|
24
|
+
type InputPropsWithoutPlaceholder = Omit<InputProps, 'placeholder'>;
|
|
18
25
|
|
|
19
|
-
export interface TextAreaProps extends
|
|
26
|
+
export interface TextAreaProps extends InputPropsWithoutSizeAndIcon {
|
|
20
27
|
height?: number;
|
|
21
28
|
}
|
|
22
29
|
|
|
23
|
-
export interface SearchInputProps
|
|
24
|
-
extends TextInputProps,
|
|
25
|
-
InputPropsWithoutSize {
|
|
30
|
+
export interface SearchInputProps extends InputPropsWithoutRequiredAndSize {
|
|
26
31
|
buttonText?: string;
|
|
27
32
|
showButtonText?: boolean;
|
|
28
33
|
showIcon?: boolean;
|
|
29
34
|
}
|
|
30
35
|
|
|
31
|
-
export
|
|
36
|
+
export interface MoneyInputProps extends InputPropsWithoutPlaceholder {}
|
|
37
|
+
|
|
38
|
+
export {Input, TextArea, SearchInput, MoneyInput};
|
package/Input/styles.ts
CHANGED
|
@@ -10,14 +10,12 @@ export default StyleSheet.create({
|
|
|
10
10
|
container: {
|
|
11
11
|
borderWidth: 1,
|
|
12
12
|
borderRadius: Radius.S,
|
|
13
|
-
marginBottom: Spacing.XS,
|
|
14
13
|
height: 56,
|
|
15
14
|
paddingVertical: 8,
|
|
16
15
|
},
|
|
17
16
|
smallContainer: {
|
|
18
17
|
borderRadius: Radius.S,
|
|
19
18
|
borderWidth: 1,
|
|
20
|
-
marginBottom: Spacing.XS,
|
|
21
19
|
height: 48,
|
|
22
20
|
},
|
|
23
21
|
floatingView: {
|
|
@@ -32,6 +30,7 @@ export default StyleSheet.create({
|
|
|
32
30
|
errorView: {
|
|
33
31
|
flexDirection: 'row',
|
|
34
32
|
alignItems: 'center',
|
|
33
|
+
marginTop: Spacing.XS,
|
|
35
34
|
},
|
|
36
35
|
inputView: {
|
|
37
36
|
justifyContent: 'space-between',
|
|
@@ -96,12 +95,11 @@ export default StyleSheet.create({
|
|
|
96
95
|
flex: 1,
|
|
97
96
|
},
|
|
98
97
|
searchInput: {
|
|
99
|
-
width: '100%',
|
|
100
98
|
height: 36,
|
|
101
99
|
marginLeft: Spacing.S,
|
|
100
|
+
flex: 1,
|
|
102
101
|
},
|
|
103
102
|
searchInputView: {
|
|
104
|
-
flex: 1,
|
|
105
103
|
flexDirection: 'row',
|
|
106
104
|
alignItems: 'center',
|
|
107
105
|
},
|
|
@@ -116,4 +114,11 @@ export default StyleSheet.create({
|
|
|
116
114
|
width: 1,
|
|
117
115
|
marginLeft: Spacing.XS,
|
|
118
116
|
},
|
|
117
|
+
moneyInput: {
|
|
118
|
+
width: '100%',
|
|
119
|
+
paddingLeft: Spacing.M,
|
|
120
|
+
height: '100%',
|
|
121
|
+
fontSize: 20,
|
|
122
|
+
fontWeight: 'bold',
|
|
123
|
+
},
|
|
119
124
|
});
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import React, {useContext} from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
DeviceEventEmitter,
|
|
4
|
+
StatusBar,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
TouchableOpacity,
|
|
7
|
+
View,
|
|
8
|
+
} from 'react-native';
|
|
3
9
|
import {ApplicationContext, NavigationButton} from './index';
|
|
4
|
-
import {Colors, Styles} from '../Consts';
|
|
10
|
+
import {Colors, Spacing, Styles} from '../Consts';
|
|
5
11
|
import {Image} from '../Image';
|
|
6
12
|
import {HeaderBackgroundProps, TitleCustomProps} from './types';
|
|
7
13
|
import {useGridSystem} from '../Layout';
|
|
8
14
|
import {Text} from '../Text';
|
|
15
|
+
import {Icon} from '../Icon';
|
|
9
16
|
|
|
10
17
|
const styles = StyleSheet.create({
|
|
11
18
|
headerBackground: {
|
|
@@ -29,10 +36,47 @@ const styles = StyleSheet.create({
|
|
|
29
36
|
borderWidth: 1,
|
|
30
37
|
borderColor: Colors.black_01,
|
|
31
38
|
},
|
|
39
|
+
headerRightButton: {
|
|
40
|
+
flexDirection: 'row',
|
|
41
|
+
overflow: 'hidden',
|
|
42
|
+
justifyContent: 'center',
|
|
43
|
+
alignItems: 'center',
|
|
44
|
+
paddingRight: Spacing.M,
|
|
45
|
+
},
|
|
46
|
+
toolkitContainer: {
|
|
47
|
+
marginLeft: Spacing.S,
|
|
48
|
+
padding: Spacing.XS,
|
|
49
|
+
height: 28,
|
|
50
|
+
borderWidth: 0.5,
|
|
51
|
+
borderRadius: 14,
|
|
52
|
+
borderColor: '#00000066',
|
|
53
|
+
justifyContent: 'center',
|
|
54
|
+
alignItems: 'center',
|
|
55
|
+
flexDirection: 'row',
|
|
56
|
+
},
|
|
57
|
+
divider: {
|
|
58
|
+
width: 1,
|
|
59
|
+
height: 12,
|
|
60
|
+
marginHorizontal: 4,
|
|
61
|
+
},
|
|
62
|
+
headerLeft: {
|
|
63
|
+
marginLeft: 12,
|
|
64
|
+
},
|
|
32
65
|
});
|
|
33
66
|
|
|
34
|
-
const
|
|
35
|
-
|
|
67
|
+
const HeaderTitle = (props: any) => {
|
|
68
|
+
return (
|
|
69
|
+
<Text
|
|
70
|
+
{...props}
|
|
71
|
+
typography="header_default"
|
|
72
|
+
weight="bold"
|
|
73
|
+
color={props.tintColor}
|
|
74
|
+
/>
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const HeaderLeft: React.FC<any> = ({tintColor}) => {
|
|
79
|
+
const {theme, navigator} = useContext(ApplicationContext);
|
|
36
80
|
const goBack = () => {
|
|
37
81
|
const canGoBack = navigator?.ref.current?.canGoBack();
|
|
38
82
|
if (canGoBack) {
|
|
@@ -43,12 +87,30 @@ const HeaderLeft = (props: any) => {
|
|
|
43
87
|
DeviceEventEmitter.emit('dismiss', {requestId});
|
|
44
88
|
}
|
|
45
89
|
};
|
|
46
|
-
|
|
90
|
+
|
|
91
|
+
let backgroundColor;
|
|
92
|
+
if (tintColor != Colors.black_01) {
|
|
93
|
+
backgroundColor = theme.colors.background.surface;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return (
|
|
97
|
+
<View style={styles.headerLeft}>
|
|
98
|
+
<NavigationButton
|
|
99
|
+
icon="ic_back"
|
|
100
|
+
tintColor={tintColor}
|
|
101
|
+
backgroundColor={backgroundColor}
|
|
102
|
+
onPress={goBack}
|
|
103
|
+
/>
|
|
104
|
+
</View>
|
|
105
|
+
);
|
|
47
106
|
};
|
|
48
107
|
|
|
49
|
-
const HeaderBackground: React.FC<HeaderBackgroundProps> = ({
|
|
108
|
+
const HeaderBackground: React.FC<HeaderBackgroundProps> = ({
|
|
109
|
+
image,
|
|
110
|
+
backgroundColor,
|
|
111
|
+
}) => {
|
|
50
112
|
const {theme} = useContext(ApplicationContext);
|
|
51
|
-
let headerImage =
|
|
113
|
+
let headerImage = theme.assets?.headerBackground;
|
|
52
114
|
if (image === null) {
|
|
53
115
|
headerImage = undefined;
|
|
54
116
|
}
|
|
@@ -56,10 +118,13 @@ const HeaderBackground: React.FC<HeaderBackgroundProps> = ({image}) => {
|
|
|
56
118
|
<View
|
|
57
119
|
style={[
|
|
58
120
|
Styles.flex,
|
|
59
|
-
{
|
|
121
|
+
{
|
|
122
|
+
backgroundColor: backgroundColor ?? theme.colors.background.default,
|
|
123
|
+
overflow: 'hidden',
|
|
124
|
+
},
|
|
60
125
|
]}>
|
|
61
126
|
<StatusBar
|
|
62
|
-
barStyle={
|
|
127
|
+
barStyle={headerImage || theme.dark ? 'light-content' : 'dark-content'}
|
|
63
128
|
/>
|
|
64
129
|
{headerImage && (
|
|
65
130
|
<Image style={styles.headerBackground} source={{uri: headerImage}} />
|
|
@@ -126,7 +191,50 @@ const HeaderRightAction: React.FC<any> = ({children, ...restProps}) => {
|
|
|
126
191
|
validType(children);
|
|
127
192
|
return React.cloneElement(children, {...restProps});
|
|
128
193
|
};
|
|
129
|
-
return <View style={
|
|
194
|
+
return <View style={styles.headerRightButton}>{renderAction()}</View>;
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
const HeaderToolkitAction: React.FC<any> = ({tintColor}) => {
|
|
198
|
+
const {theme} = useContext(ApplicationContext);
|
|
199
|
+
let backgroundColor;
|
|
200
|
+
if (tintColor != Colors.black_01) {
|
|
201
|
+
backgroundColor = theme.colors.background.surface;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
return (
|
|
205
|
+
<View style={styles.headerRightButton}>
|
|
206
|
+
<NavigationButton
|
|
207
|
+
icon="addFavorite"
|
|
208
|
+
tintColor={tintColor}
|
|
209
|
+
backgroundColor={backgroundColor}
|
|
210
|
+
onPress={() => {}}
|
|
211
|
+
/>
|
|
212
|
+
<View
|
|
213
|
+
style={[
|
|
214
|
+
styles.toolkitContainer,
|
|
215
|
+
{backgroundColor: backgroundColor ?? '#00000066'},
|
|
216
|
+
]}>
|
|
217
|
+
<TouchableOpacity>
|
|
218
|
+
<Icon color={tintColor} source="navigation_more_horiz" size={20} />
|
|
219
|
+
</TouchableOpacity>
|
|
220
|
+
<View style={[styles.divider, {backgroundColor: tintColor}]} />
|
|
221
|
+
<TouchableOpacity>
|
|
222
|
+
<Icon
|
|
223
|
+
color={tintColor}
|
|
224
|
+
source="16_navigation_close_circle"
|
|
225
|
+
size={20}
|
|
226
|
+
/>
|
|
227
|
+
</TouchableOpacity>
|
|
228
|
+
</View>
|
|
229
|
+
</View>
|
|
230
|
+
);
|
|
130
231
|
};
|
|
131
232
|
|
|
132
|
-
export {
|
|
233
|
+
export {
|
|
234
|
+
HeaderTitle,
|
|
235
|
+
HeaderLeft,
|
|
236
|
+
HeaderBackground,
|
|
237
|
+
HeaderRightAction,
|
|
238
|
+
HeaderToolkitAction,
|
|
239
|
+
HeaderCustom,
|
|
240
|
+
};
|
|
@@ -10,7 +10,7 @@ import {SafeAreaView, useSafeAreaInsets} from 'react-native-safe-area-context';
|
|
|
10
10
|
import {BottomSheetBackdrop, BottomSheetModal} from '@gorhom/bottom-sheet';
|
|
11
11
|
import {BottomSheetModalMethods} from '@gorhom/bottom-sheet/lib/typescript/types';
|
|
12
12
|
import Navigation from './Navigation';
|
|
13
|
-
import {ModalParams} from './types';
|
|
13
|
+
import {BottomSheetParams, ModalParams} from './types';
|
|
14
14
|
import {Radius, Spacing, Styles} from '../Consts';
|
|
15
15
|
import {
|
|
16
16
|
ApplicationContext,
|
|
@@ -19,15 +19,22 @@ import {
|
|
|
19
19
|
NavigationContainer,
|
|
20
20
|
} from './index';
|
|
21
21
|
|
|
22
|
-
const ModalScreen: React.FC<
|
|
22
|
+
const ModalScreen: React.FC<any> = props => {
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
return () => {
|
|
25
|
+
props.route.params?.onDismiss?.();
|
|
26
|
+
};
|
|
27
|
+
}, []);
|
|
28
|
+
|
|
29
|
+
if (props.route?.params?.isBottomSheet) {
|
|
30
|
+
return <BottomSheet {...props} />;
|
|
31
|
+
}
|
|
32
|
+
return <Modal {...props} />;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const Modal: React.FC<ModalParams> = ({navigation, route}) => {
|
|
23
36
|
const {theme} = useContext(ApplicationContext);
|
|
24
|
-
const {
|
|
25
|
-
isBottomSheet,
|
|
26
|
-
backgroundColor,
|
|
27
|
-
screen,
|
|
28
|
-
barrierDismissible,
|
|
29
|
-
options,
|
|
30
|
-
}: ModalParams = route.params;
|
|
37
|
+
const {screen, barrierDismissible}: ModalParams = route.params;
|
|
31
38
|
const Component = useRef(screen).current;
|
|
32
39
|
const params = {
|
|
33
40
|
...route.params,
|
|
@@ -35,61 +42,13 @@ const ModalScreen: React.FC<ModalParams> = ({navigation, route, ...rest}) => {
|
|
|
35
42
|
};
|
|
36
43
|
delete params.screen;
|
|
37
44
|
|
|
38
|
-
/**
|
|
39
|
-
* onDismiss modal
|
|
40
|
-
*/
|
|
41
45
|
const onDismiss = (pop = true) => {
|
|
42
|
-
|
|
43
|
-
if (!pop) {
|
|
44
|
-
action = () => {};
|
|
45
|
-
}
|
|
46
|
-
if (barrierDismissible && !isBottomSheet) {
|
|
46
|
+
if (barrierDismissible) {
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
|
-
|
|
50
|
-
action();
|
|
49
|
+
navigation.pop();
|
|
51
50
|
};
|
|
52
51
|
|
|
53
|
-
/**
|
|
54
|
-
* build bottom sheet
|
|
55
|
-
*/
|
|
56
|
-
if (isBottomSheet) {
|
|
57
|
-
const bgColor = backgroundColor ?? theme.colors.background.surface;
|
|
58
|
-
const sheetTheme = {...theme, assets: undefined};
|
|
59
|
-
return (
|
|
60
|
-
<BottomSheet {...rest} onDismiss={onDismiss}>
|
|
61
|
-
<View style={[styles.sheetContainer, {backgroundColor: bgColor}]}>
|
|
62
|
-
<View style={styles.indicatorContainer}>
|
|
63
|
-
<View
|
|
64
|
-
style={[
|
|
65
|
-
styles.indicator,
|
|
66
|
-
{backgroundColor: theme.colors.text.disable},
|
|
67
|
-
]}
|
|
68
|
-
/>
|
|
69
|
-
</View>
|
|
70
|
-
<NavigationContainer
|
|
71
|
-
theme={sheetTheme}
|
|
72
|
-
screen={props => <Component {...props} {...params} />}
|
|
73
|
-
options={{
|
|
74
|
-
...options,
|
|
75
|
-
hiddenBack: true,
|
|
76
|
-
headerTitleAlign: 'center',
|
|
77
|
-
headerRight: (props: any) => (
|
|
78
|
-
<HeaderRightAction>
|
|
79
|
-
<NavigationButton
|
|
80
|
-
icon="24_navigation_close"
|
|
81
|
-
{...props}
|
|
82
|
-
onPress={() => navigation.pop()}
|
|
83
|
-
/>
|
|
84
|
-
</HeaderRightAction>
|
|
85
|
-
),
|
|
86
|
-
}}
|
|
87
|
-
/>
|
|
88
|
-
</View>
|
|
89
|
-
</BottomSheet>
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
52
|
return (
|
|
94
53
|
<KeyboardAvoidingView
|
|
95
54
|
style={Styles.flex}
|
|
@@ -121,7 +80,16 @@ const ModalScreen: React.FC<ModalParams> = ({navigation, route, ...rest}) => {
|
|
|
121
80
|
);
|
|
122
81
|
};
|
|
123
82
|
|
|
124
|
-
const BottomSheet: React.FC<
|
|
83
|
+
const BottomSheet: React.FC<BottomSheetParams> = ({navigation, route}) => {
|
|
84
|
+
const {theme} = useContext(ApplicationContext);
|
|
85
|
+
const {screen, options}: BottomSheetParams = route.params;
|
|
86
|
+
const Component = useRef(screen).current;
|
|
87
|
+
const params = {
|
|
88
|
+
...route.params,
|
|
89
|
+
navigation: new Navigation(navigation, theme),
|
|
90
|
+
};
|
|
91
|
+
delete params.screen;
|
|
92
|
+
|
|
125
93
|
const snapPoints = useMemo(() => ['50%', '90%'], []);
|
|
126
94
|
const {bottom} = useSafeAreaInsets();
|
|
127
95
|
const bottomSheetRef = useRef<BottomSheetModalMethods>(null);
|
|
@@ -142,24 +110,57 @@ const BottomSheet: React.FC<ModalParams> = ({children, onDismiss}) => {
|
|
|
142
110
|
/>
|
|
143
111
|
);
|
|
144
112
|
|
|
113
|
+
let backgroundColor = theme.colors.background.default;
|
|
114
|
+
if (options?.surface) {
|
|
115
|
+
backgroundColor = theme.colors.background.surface;
|
|
116
|
+
}
|
|
117
|
+
const sheetTheme = {...theme, assets: undefined};
|
|
118
|
+
|
|
145
119
|
return (
|
|
146
120
|
<SafeAreaView style={Styles.flex}>
|
|
147
121
|
<BottomSheetModal
|
|
148
122
|
ref={bottomSheetRef}
|
|
149
123
|
snapPoints={snapPoints}
|
|
150
|
-
onDismiss={
|
|
124
|
+
onDismiss={navigation.pop}
|
|
151
125
|
handleComponent={null}
|
|
152
126
|
backdropComponent={backdropComponent}>
|
|
153
|
-
<View style={{paddingBottom: bottom}}>
|
|
127
|
+
<View style={{paddingBottom: bottom}}>
|
|
128
|
+
<View style={[styles.sheetContainer, {backgroundColor}]}>
|
|
129
|
+
<View style={styles.indicatorContainer}>
|
|
130
|
+
<View
|
|
131
|
+
style={[
|
|
132
|
+
styles.indicator,
|
|
133
|
+
{backgroundColor: theme.colors.text.disable},
|
|
134
|
+
]}
|
|
135
|
+
/>
|
|
136
|
+
</View>
|
|
137
|
+
<NavigationContainer
|
|
138
|
+
theme={sheetTheme}
|
|
139
|
+
screen={props => <Component {...props} {...params} />}
|
|
140
|
+
options={{
|
|
141
|
+
...options,
|
|
142
|
+
...{headerLeft: null},
|
|
143
|
+
headerTitleAlign: 'center',
|
|
144
|
+
headerRight: props => (
|
|
145
|
+
<HeaderRightAction>
|
|
146
|
+
<NavigationButton
|
|
147
|
+
{...props}
|
|
148
|
+
icon="24_navigation_close"
|
|
149
|
+
backgroundColor="transparent"
|
|
150
|
+
useBorder={false}
|
|
151
|
+
onPress={() => bottomSheetRef.current?.dismiss()}
|
|
152
|
+
/>
|
|
153
|
+
</HeaderRightAction>
|
|
154
|
+
),
|
|
155
|
+
}}
|
|
156
|
+
/>
|
|
157
|
+
</View>
|
|
158
|
+
</View>
|
|
154
159
|
</BottomSheetModal>
|
|
155
160
|
</SafeAreaView>
|
|
156
161
|
);
|
|
157
162
|
};
|
|
158
163
|
|
|
159
|
-
ModalScreen.defaultProps = {
|
|
160
|
-
barrierDismissible: false,
|
|
161
|
-
};
|
|
162
|
-
|
|
163
164
|
const styles = StyleSheet.create({
|
|
164
165
|
container: {flex: 1, flexDirection: 'row'},
|
|
165
166
|
modalContent: {
|
|
@@ -8,20 +8,35 @@ const NavigationButton: React.FC<NavigationButtonProps> = ({
|
|
|
8
8
|
icon,
|
|
9
9
|
tintColor,
|
|
10
10
|
onPress,
|
|
11
|
+
backgroundColor,
|
|
12
|
+
useBorder = true,
|
|
11
13
|
}) => {
|
|
12
14
|
const {theme} = useContext(ApplicationContext);
|
|
13
15
|
return (
|
|
14
|
-
<TouchableOpacity
|
|
15
|
-
|
|
16
|
+
<TouchableOpacity
|
|
17
|
+
style={[
|
|
18
|
+
styles.container,
|
|
19
|
+
{
|
|
20
|
+
backgroundColor: backgroundColor ?? '#00000066',
|
|
21
|
+
borderWidth: useBorder ? 0.5 : 0,
|
|
22
|
+
},
|
|
23
|
+
]}
|
|
24
|
+
onPress={onPress}>
|
|
25
|
+
<Icon
|
|
26
|
+
source={icon}
|
|
27
|
+
color={tintColor ?? theme.colors.text.default}
|
|
28
|
+
size={20}
|
|
29
|
+
/>
|
|
16
30
|
</TouchableOpacity>
|
|
17
31
|
);
|
|
18
32
|
};
|
|
19
33
|
|
|
20
34
|
const styles = StyleSheet.create({
|
|
21
35
|
container: {
|
|
22
|
-
height:
|
|
23
|
-
width:
|
|
24
|
-
borderRadius:
|
|
36
|
+
height: 28,
|
|
37
|
+
width: 28,
|
|
38
|
+
borderRadius: 14,
|
|
39
|
+
borderColor: '#00000066',
|
|
25
40
|
justifyContent: 'center',
|
|
26
41
|
alignItems: 'center',
|
|
27
42
|
},
|
package/Navigation/Navigator.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {StackActions} from '@react-navigation/native';
|
|
2
|
-
import {ModalParams, ScreenParams} from './types';
|
|
2
|
+
import {BottomSheetParams, ModalParams, ScreenParams} from './types';
|
|
3
3
|
|
|
4
4
|
class Navigator {
|
|
5
5
|
ref?: any;
|
|
@@ -28,7 +28,7 @@ class Navigator {
|
|
|
28
28
|
this.ref.current.dispatch(StackActions.push('Modal', params));
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
showBottomSheet = (params:
|
|
31
|
+
showBottomSheet = (params: BottomSheetParams) => {
|
|
32
32
|
this.ref.current.dispatch(
|
|
33
33
|
StackActions.push('Modal', {
|
|
34
34
|
...params,
|
package/Navigation/types.ts
CHANGED
|
@@ -85,18 +85,23 @@ export interface ModalParams extends ScreenParams {
|
|
|
85
85
|
screen: React.ElementType;
|
|
86
86
|
onDismiss?: (mounted?: boolean) => void;
|
|
87
87
|
barrierDismissible?: boolean;
|
|
88
|
-
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface BottomSheetParams extends ScreenParams {
|
|
91
|
+
[key: string]: any;
|
|
92
|
+
onDismiss?: () => void;
|
|
89
93
|
}
|
|
90
94
|
|
|
91
95
|
export type NavigationButtonProps = {
|
|
92
96
|
icon: string;
|
|
93
97
|
tintColor?: string;
|
|
98
|
+
backgroundColor?: string;
|
|
99
|
+
useBorder?: boolean;
|
|
94
100
|
onPress: () => void;
|
|
95
101
|
};
|
|
96
102
|
|
|
97
103
|
export type NavigationOptions = {
|
|
98
104
|
surface?: boolean;
|
|
99
|
-
hiddenBack?: boolean;
|
|
100
105
|
title?: string;
|
|
101
106
|
headerTitleAlign?: 'left' | 'center';
|
|
102
107
|
customTitle?: TitleCustomProps;
|
|
@@ -105,6 +110,7 @@ export type NavigationOptions = {
|
|
|
105
110
|
|
|
106
111
|
export type HeaderBackgroundProps = {
|
|
107
112
|
image?: string | null;
|
|
113
|
+
backgroundColor?: string | null;
|
|
108
114
|
};
|
|
109
115
|
|
|
110
116
|
export type TitleCustomProps = {
|
package/Navigation/utils.tsx
CHANGED
|
@@ -3,21 +3,15 @@ import {
|
|
|
3
3
|
StackNavigationOptions,
|
|
4
4
|
TransitionPresets,
|
|
5
5
|
} from '@react-navigation/stack';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
HeaderBackground,
|
|
8
|
+
HeaderCustom,
|
|
9
|
+
HeaderLeft,
|
|
10
|
+
HeaderTitle,
|
|
11
|
+
HeaderToolkitAction,
|
|
12
|
+
} from './Components';
|
|
7
13
|
import {NavigationOptions, Theme} from './types';
|
|
8
14
|
import {Colors} from '../Consts';
|
|
9
|
-
import {Text} from '../Text';
|
|
10
|
-
|
|
11
|
-
const HeaderTitle = (props: any) => {
|
|
12
|
-
return (
|
|
13
|
-
<Text
|
|
14
|
-
{...props}
|
|
15
|
-
typography="header_default"
|
|
16
|
-
weight="bold"
|
|
17
|
-
color={props.tintColor}
|
|
18
|
-
/>
|
|
19
|
-
);
|
|
20
|
-
};
|
|
21
15
|
|
|
22
16
|
const getTintColor = (theme: Theme): any => {
|
|
23
17
|
if (theme.assets?.headerBackground) {
|
|
@@ -36,6 +30,7 @@ const getStackOptions = (theme: Theme): StackNavigationOptions => {
|
|
|
36
30
|
headerTitle: HeaderTitle,
|
|
37
31
|
headerBackground: HeaderBackground,
|
|
38
32
|
headerLeft: (props: any) => <HeaderLeft {...props} />,
|
|
33
|
+
headerRight: (props: any) => <HeaderToolkitAction {...props} />,
|
|
39
34
|
...getTintColor(theme),
|
|
40
35
|
};
|
|
41
36
|
};
|
|
@@ -45,6 +40,7 @@ const getDialogOptions = (theme: Theme): StackNavigationOptions => {
|
|
|
45
40
|
headerTitleAlign: 'center',
|
|
46
41
|
headerTitle: HeaderTitle,
|
|
47
42
|
headerLeft: (props: any) => <HeaderLeft {...props} />,
|
|
43
|
+
headerRight: (props: any) => <HeaderToolkitAction {...props} />,
|
|
48
44
|
headerBackground: HeaderBackground,
|
|
49
45
|
...getTintColor(theme),
|
|
50
46
|
...TransitionPresets.ModalTransition,
|
|
@@ -77,23 +73,17 @@ const getModalOptions = (): StackNavigationOptions => {
|
|
|
77
73
|
};
|
|
78
74
|
|
|
79
75
|
const getOptions = (params: NavigationOptions, theme: Theme) => {
|
|
80
|
-
let backTheme: {};
|
|
81
76
|
let surfaceTheme: {};
|
|
82
77
|
let titleTheme: {};
|
|
83
78
|
|
|
84
|
-
if (params.hiddenBack == true) {
|
|
85
|
-
backTheme = {
|
|
86
|
-
headerLeft: null,
|
|
87
|
-
};
|
|
88
|
-
} else {
|
|
89
|
-
backTheme = {
|
|
90
|
-
headerLeft: (props: any) => <HeaderLeft {...props} />,
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
|
|
94
79
|
if (params.surface == true) {
|
|
95
80
|
surfaceTheme = {
|
|
96
|
-
headerBackground: () =>
|
|
81
|
+
headerBackground: () => (
|
|
82
|
+
<HeaderBackground
|
|
83
|
+
image={null}
|
|
84
|
+
backgroundColor={theme.colors.background.surface}
|
|
85
|
+
/>
|
|
86
|
+
),
|
|
97
87
|
...getTintColor({
|
|
98
88
|
...theme,
|
|
99
89
|
assets: {...theme.assets, headerBackground: undefined},
|
|
@@ -119,7 +109,7 @@ const getOptions = (params: NavigationOptions, theme: Theme) => {
|
|
|
119
109
|
};
|
|
120
110
|
}
|
|
121
111
|
|
|
122
|
-
return {...params, ...
|
|
112
|
+
return {...params, ...surfaceTheme, ...titleTheme};
|
|
123
113
|
};
|
|
124
114
|
|
|
125
115
|
export {getStackOptions, getDialogOptions, getModalOptions, getOptions};
|
package/Popup/PopupNotify.tsx
CHANGED
|
@@ -148,7 +148,10 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
148
148
|
</View>
|
|
149
149
|
{information && (
|
|
150
150
|
<View style={styles.information}>
|
|
151
|
-
<Text
|
|
151
|
+
<Text
|
|
152
|
+
typography={'description_xs'}
|
|
153
|
+
color={theme.colors.text.hint}
|
|
154
|
+
numberOfLines={1}>
|
|
152
155
|
{information}
|
|
153
156
|
</Text>
|
|
154
157
|
</View>
|
package/Text/index.tsx
CHANGED
|
@@ -18,6 +18,20 @@ const SFProText: TypographyWeight = {
|
|
|
18
18
|
bold: 'Bold',
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
+
const AlegreyaSans: TypographyWeight = {
|
|
22
|
+
100: 'Thin',
|
|
23
|
+
200: 'Thin',
|
|
24
|
+
300: 'Thin',
|
|
25
|
+
400: 'Regular',
|
|
26
|
+
500: 'Medium',
|
|
27
|
+
600: 'Medium',
|
|
28
|
+
700: 'Bold',
|
|
29
|
+
800: 'Black',
|
|
30
|
+
900: 'Black',
|
|
31
|
+
normal: 'Regular',
|
|
32
|
+
bold: 'Bold',
|
|
33
|
+
};
|
|
34
|
+
|
|
21
35
|
const FontStyle: {[key: string]: string} = {
|
|
22
36
|
italic: 'Italic',
|
|
23
37
|
normal: '',
|
|
@@ -43,14 +57,18 @@ const Text: React.FC<TextProps> = ({
|
|
|
43
57
|
} = styles;
|
|
44
58
|
const typoStyle = styleSheet[typo] ?? styleSheet.paragraph_default;
|
|
45
59
|
const {fontWeight, fontSize, fontStyle, lineHeight} = typoStyle;
|
|
46
|
-
let fontFamily: string;
|
|
47
60
|
const style = FontStyle[fontStyle ?? 'normal'];
|
|
61
|
+
let fontFamily: string;
|
|
48
62
|
|
|
49
63
|
switch (theme.font) {
|
|
50
64
|
case 'SFProText': {
|
|
51
65
|
fontFamily = `${theme.font}-${SFProText[fontWeight]}${style}`;
|
|
52
66
|
break;
|
|
53
67
|
}
|
|
68
|
+
case 'AlegreyaSans': {
|
|
69
|
+
fontFamily = `${theme.font}-${AlegreyaSans[fontWeight]}${style}`;
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
54
72
|
default: {
|
|
55
73
|
fontFamily = `SFProText-${SFProText[fontWeight]}${style}`;
|
|
56
74
|
}
|