@momo-kits/foundation 1.0.8 → 1.0.9
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/SearchInput.tsx +28 -30
- package/Input/styles.ts +1 -2
- 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/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/styles.ts
CHANGED
|
@@ -96,12 +96,11 @@ export default StyleSheet.create({
|
|
|
96
96
|
flex: 1,
|
|
97
97
|
},
|
|
98
98
|
searchInput: {
|
|
99
|
-
width: '100%',
|
|
100
99
|
height: 36,
|
|
101
100
|
marginLeft: Spacing.S,
|
|
101
|
+
flex: 1,
|
|
102
102
|
},
|
|
103
103
|
searchInputView: {
|
|
104
|
-
flex: 1,
|
|
105
104
|
flexDirection: 'row',
|
|
106
105
|
alignItems: 'center',
|
|
107
106
|
},
|
|
@@ -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
|
}
|