@momo-kits/foundation 0.77.7 → 0.77.8-beta.2

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.
@@ -41,8 +41,8 @@ const BottomTab: React.FC<BottomTabProps> = ({tabs, listeners}) => {
41
41
  alignSelf: 'center',
42
42
  fontFamily: `${theme.font}-Bold`,
43
43
  },
44
- tabBarIcon: ({color, size}) => (
45
- <Icon source={item.icon} color={color} size={size} />
44
+ tabBarIcon: ({color}) => (
45
+ <Icon source={item.icon} color={color} size={28} />
46
46
  ),
47
47
  }}
48
48
  />
@@ -1,5 +1,6 @@
1
1
  import React, {useContext, useEffect, useState} from 'react';
2
2
  import {
3
+ Alert,
3
4
  Animated,
4
5
  DeviceEventEmitter,
5
6
  StatusBar,
@@ -7,13 +8,14 @@ import {
7
8
  TouchableOpacity,
8
9
  View,
9
10
  } from 'react-native';
10
- import {ApplicationContext, NavigationButton} from './index';
11
+ import {ApplicationContext} from './index';
11
12
  import {Colors, Radius, Spacing, Styles} from '../Consts';
12
13
  import {Image} from '../Image';
13
14
  import {
14
15
  HeaderBackgroundProps,
15
16
  HeaderBackProps,
16
17
  HeaderToolkitProps,
18
+ NavigationButtonProps,
17
19
  TitleCustomProps,
18
20
  } from './types';
19
21
  import {scaleSize, Text} from '../Text';
@@ -21,6 +23,14 @@ import {Icon} from '../Icon';
21
23
  import {PopupNotify} from '../Popup';
22
24
 
23
25
  const styles = StyleSheet.create({
26
+ navigationButton: {
27
+ height: 28,
28
+ width: 28,
29
+ borderRadius: 14,
30
+ borderColor: '#00000066',
31
+ justifyContent: 'center',
32
+ alignItems: 'center',
33
+ },
24
34
  headerBackground: {
25
35
  width: '100%',
26
36
  height: undefined,
@@ -77,6 +87,39 @@ const styles = StyleSheet.create({
77
87
  },
78
88
  });
79
89
 
90
+ const NavigationButton: React.FC<NavigationButtonProps> = ({
91
+ icon,
92
+ tintColor,
93
+ onPress,
94
+ backgroundColor,
95
+ useBorder = true,
96
+ accessibilityLabel,
97
+ }) => {
98
+ const {theme} = useContext(ApplicationContext);
99
+ if (!backgroundColor && tintColor != Colors.black_01) {
100
+ backgroundColor = theme.colors.background.surface;
101
+ }
102
+
103
+ return (
104
+ <TouchableOpacity
105
+ accessibilityLabel={`NavigationButton/${accessibilityLabel}`}
106
+ style={[
107
+ styles.navigationButton,
108
+ {
109
+ backgroundColor: backgroundColor ?? '#00000066',
110
+ borderWidth: useBorder && backgroundColor ? 0.5 : 0,
111
+ },
112
+ ]}
113
+ onPress={onPress}>
114
+ <Icon
115
+ source={icon}
116
+ color={tintColor ?? theme.colors.text.default}
117
+ size={20}
118
+ />
119
+ </TouchableOpacity>
120
+ );
121
+ };
122
+
80
123
  const HeaderTitle: React.FC<any> = ({accessibilityLabel = '', ...props}) => {
81
124
  const {theme} = useContext(ApplicationContext);
82
125
  const opacity = props.animatedValue?.interpolate({
@@ -100,6 +143,7 @@ const HeaderTitle: React.FC<any> = ({accessibilityLabel = '', ...props}) => {
100
143
  const HeaderLeft: React.FC<HeaderBackProps> = ({
101
144
  tintColor,
102
145
  preventBack,
146
+ onPressLeftHeader,
103
147
  useBorder,
104
148
  backgroundColor,
105
149
  accessibilityLabel = '',
@@ -131,6 +175,7 @@ const HeaderLeft: React.FC<HeaderBackProps> = ({
131
175
  const requestId = `navigationBackPress#${currentTime}`;
132
176
  DeviceEventEmitter.emit('dismiss', {requestId});
133
177
  }
178
+ onPressLeftHeader?.();
134
179
  };
135
180
 
136
181
  return (
@@ -220,8 +265,9 @@ const HeaderCustom: React.FC<TitleCustomProps> = ({
220
265
  const HeaderRightAction: React.FC<any> = ({children, ...restProps}) => {
221
266
  const validType = (item: any) => {
222
267
  if (__DEV__ && item.type !== NavigationButton) {
223
- console.warn(
224
- 'element type of NavigationButton, Please migrate to use NavigationButton of kits.',
268
+ Alert.alert(
269
+ 'Rule',
270
+ 'HeaderRightAction contains element type of NavigationButton, Please check again.',
225
271
  );
226
272
  return <View />;
227
273
  }
@@ -366,6 +412,7 @@ const HeaderToolkitAction: React.FC<any> = ({tintColor}) => {
366
412
  };
367
413
 
368
414
  export {
415
+ NavigationButton,
369
416
  HeaderTitle,
370
417
  HeaderLeft,
371
418
  HeaderBackground,
@@ -8,7 +8,6 @@ import {
8
8
  } from 'react-native';
9
9
  import {SafeAreaView, useSafeAreaInsets} from 'react-native-safe-area-context';
10
10
  import {BottomSheetBackdrop, BottomSheetModal} from '@gorhom/bottom-sheet';
11
- import {BottomSheetModalMethods} from '@gorhom/bottom-sheet/lib/typescript/types';
12
11
  import Navigation from './Navigation';
13
12
  import {BottomSheetParams, ModalParams} from './types';
14
13
  import {Radius, Spacing, Styles} from '../Consts';
@@ -97,7 +96,7 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
97
96
 
98
97
  const snapPoints = useMemo(() => ['50%', '90%'], []);
99
98
  const {bottom} = useSafeAreaInsets();
100
- const bottomSheetRef = useRef<BottomSheetModalMethods>(null);
99
+ const bottomSheetRef = useRef(null);
101
100
  const mountedRef = useRef(true);
102
101
 
103
102
  useEffect(() => {
@@ -1,4 +1,5 @@
1
1
  import {NavigationProp} from '@react-navigation/native';
2
+ import {Alert} from 'react-native';
2
3
  import {NavigationOptions, Theme} from './types';
3
4
  import {HeaderRightAction} from './index';
4
5
  import {getOptions} from './utils';
@@ -13,26 +14,23 @@ class Navigation {
13
14
  this.theme = theme;
14
15
  }
15
16
 
16
- private verifyParams = (params: NavigationOptions) => {
17
+ private filterParams = (params: NavigationOptions) => {
17
18
  if (params.headerRight) {
18
19
  const headerRight = params.headerRight?.();
19
- if (
20
- headerRight?.type !== HeaderRightAction &&
21
- headerRight?.type !== HeaderToolkitAction
22
- ) {
23
- console.warn(
24
- 'headerRight not return element type of HeaderRightAction | HeaderToolkitAction, Please migrate to use of kits.',
20
+ const type = headerRight?.type;
21
+ if (type !== HeaderRightAction && type !== HeaderToolkitAction) {
22
+ Alert.alert(
23
+ 'Rule',
24
+ 'headerRight contains element type of HeaderRightAction | HeaderToolkitAction, Please check again.',
25
25
  );
26
+ delete params.headerRight;
26
27
  }
27
28
  }
28
29
  return params;
29
30
  };
30
31
 
31
- private filterParams = (params: NavigationOptions) => {
32
- return params;
33
- };
34
-
35
32
  setOptions = (params: NavigationOptions) => {
33
+ console.log(params);
36
34
  if (__DEV__) {
37
35
  params = this.filterParams(params);
38
36
  }
@@ -1,7 +1,6 @@
1
1
  import {NavigationContainer} from './NavigationContainer';
2
2
  import Screen from '../Layout/Screen';
3
- import NavigationButton from './NavigationButton';
4
- import {HeaderRightAction} from './Components';
3
+ import {HeaderRightAction, NavigationButton} from './Components';
5
4
  import BottomTab from './BottomTab';
6
5
  import {createContext} from 'react';
7
6
  import {defaultContext} from '../Consts';
@@ -121,6 +121,7 @@ export type NavigationButtonProps = {
121
121
 
122
122
  export type NavigationOptions = {
123
123
  preventBack?: PopupNotifyProps;
124
+ onPressLeftHeader?: () => void;
124
125
  surface?: boolean;
125
126
  headerTransparent?: boolean;
126
127
  hiddenBack?: boolean;
@@ -134,6 +135,7 @@ export type NavigationOptions = {
134
135
 
135
136
  export interface HeaderBackProps extends NavigationButtonProps {
136
137
  preventBack?: PopupNotifyProps;
138
+ onPressLeftHeader?: () => void;
137
139
  accessibilityLabel?: string;
138
140
  }
139
141
 
@@ -76,6 +76,19 @@ const getOptions = (params: NavigationOptions, theme: Theme) => {
76
76
  let titleProps = {};
77
77
  let options = {};
78
78
 
79
+ if (typeof params.onPressLeftHeader === 'function') {
80
+ options = {
81
+ ...options,
82
+ headerLeft: (props: any) => (
83
+ <HeaderLeft
84
+ {...props}
85
+ preventBack={params.preventBack}
86
+ onPressLeftHeader={params.onPressLeftHeader}
87
+ />
88
+ ),
89
+ };
90
+ }
91
+
79
92
  if (params.preventBack) {
80
93
  options = {
81
94
  ...options,
@@ -0,0 +1,256 @@
1
+ {
2
+ "v": "4.8.0",
3
+ "meta": {"g": "LottieFiles AE 3.2.2", "a": "", "k": "", "d": "", "tc": ""},
4
+ "fr": 60,
5
+ "ip": 10,
6
+ "op": 54,
7
+ "w": 52,
8
+ "h": 20,
9
+ "nm": "Dot 10",
10
+ "ddd": 0,
11
+ "assets": [
12
+ {
13
+ "id": "comp_0",
14
+ "layers": [
15
+ {
16
+ "ddd": 0,
17
+ "ind": 1,
18
+ "ty": 4,
19
+ "nm": "1",
20
+ "sr": 1,
21
+ "ks": {
22
+ "o": {"a": 0, "k": 100, "ix": 11},
23
+ "r": {"a": 0, "k": 0, "ix": 10},
24
+ "p": {
25
+ "a": 1,
26
+ "k": [
27
+ {
28
+ "i": {"x": 0.711, "y": 1},
29
+ "o": {"x": 0.26, "y": 0.24},
30
+ "t": 0,
31
+ "s": [-14, 11, 0],
32
+ "to": [0, -1.172, 0],
33
+ "ti": [0, -0.21, 0]
34
+ },
35
+ {
36
+ "i": {"x": 0.667, "y": 1},
37
+ "o": {"x": 0.333, "y": 0},
38
+ "t": 17,
39
+ "s": [-14, 5, 0],
40
+ "to": [0, 0.333, 0],
41
+ "ti": [0, -1, 0]
42
+ },
43
+ {
44
+ "i": {"x": 0.833, "y": 0.542},
45
+ "o": {"x": 0.333, "y": 0},
46
+ "t": 30,
47
+ "s": [-14, 13, 0],
48
+ "to": [0, 1, 0],
49
+ "ti": [0, 0.333, 0]
50
+ },
51
+ {"t": 45, "s": [-14, 11, 0]}
52
+ ],
53
+ "ix": 2
54
+ },
55
+ "a": {"a": 0, "k": [-40, 0, 0], "ix": 1},
56
+ "s": {"a": 0, "k": [100, 100, 100], "ix": 6}
57
+ },
58
+ "ao": 0,
59
+ "shapes": [
60
+ {
61
+ "ty": "gr",
62
+ "it": [
63
+ {
64
+ "d": 1,
65
+ "ty": "el",
66
+ "s": {"a": 0, "k": [12, 12], "ix": 2},
67
+ "p": {"a": 0, "k": [0, 0], "ix": 3},
68
+ "nm": "Ellipse Path 1",
69
+ "mn": "ADBE Vector Shape - Ellipse",
70
+ "hd": false
71
+ },
72
+ {
73
+ "ty": "st",
74
+ "c": {"a": 0, "k": [1, 1, 1, 1], "ix": 3},
75
+ "o": {"a": 0, "k": 100, "ix": 4},
76
+ "w": {"a": 0, "k": 0, "ix": 5},
77
+ "lc": 1,
78
+ "lj": 1,
79
+ "ml": 4,
80
+ "bm": 0,
81
+ "nm": "Stroke 1",
82
+ "mn": "ADBE Vector Graphic - Stroke",
83
+ "hd": false
84
+ },
85
+ {
86
+ "ty": "fl",
87
+ "c": {
88
+ "a": 1,
89
+ "k": [
90
+ {
91
+ "i": {"x": [0.833], "y": [0.833]},
92
+ "o": {"x": [0.167], "y": [0.167]},
93
+ "t": 0,
94
+ "s": [0.968627510819, 0.674509803922, 0.835294177485, 1]
95
+ },
96
+ {
97
+ "i": {"x": [0.833], "y": [0.833]},
98
+ "o": {"x": [0.167], "y": [0.167]},
99
+ "t": 17,
100
+ "s": [0.921568632126, 0.184313729405, 0.588235318661, 1]
101
+ },
102
+ {
103
+ "t": 35,
104
+ "s": [0.968627510819, 0.674509803922, 0.835294177485, 1]
105
+ }
106
+ ],
107
+ "ix": 4
108
+ },
109
+ "o": {"a": 0, "k": 100, "ix": 5},
110
+ "r": 1,
111
+ "bm": 0,
112
+ "nm": "Fill 1",
113
+ "mn": "ADBE Vector Graphic - Fill",
114
+ "hd": false
115
+ },
116
+ {
117
+ "ty": "tr",
118
+ "p": {"a": 0, "k": [-20, 1], "ix": 2},
119
+ "a": {"a": 0, "k": [0, 0], "ix": 1},
120
+ "s": {"a": 0, "k": [100, 100], "ix": 3},
121
+ "r": {"a": 0, "k": 0, "ix": 6},
122
+ "o": {"a": 0, "k": 100, "ix": 7},
123
+ "sk": {"a": 0, "k": 0, "ix": 4},
124
+ "sa": {"a": 0, "k": 0, "ix": 5},
125
+ "nm": "Transform"
126
+ }
127
+ ],
128
+ "nm": "Ellipse 1",
129
+ "np": 3,
130
+ "cix": 2,
131
+ "bm": 0,
132
+ "ix": 1,
133
+ "mn": "ADBE Vector Group",
134
+ "hd": false
135
+ }
136
+ ],
137
+ "ip": 0,
138
+ "op": 45,
139
+ "st": 0,
140
+ "bm": 0
141
+ }
142
+ ]
143
+ }
144
+ ],
145
+ "layers": [
146
+ {
147
+ "ddd": 0,
148
+ "ind": 1,
149
+ "ty": 0,
150
+ "nm": "Dot 0",
151
+ "refId": "comp_0",
152
+ "sr": 1,
153
+ "ks": {
154
+ "o": {"a": 0, "k": 100, "ix": 11},
155
+ "r": {"a": 0, "k": 0, "ix": 10},
156
+ "p": {"a": 0, "k": [6, 10, 0], "ix": 2},
157
+ "a": {"a": 0, "k": [-34, 10, 0], "ix": 1},
158
+ "s": {"a": 0, "k": [100, 100, 100], "ix": 6}
159
+ },
160
+ "ao": 0,
161
+ "tm": {
162
+ "a": 1,
163
+ "k": [
164
+ {
165
+ "i": {"x": [0.833], "y": [0.833]},
166
+ "o": {"x": [0.167], "y": [0.167]},
167
+ "t": 10,
168
+ "s": [0]
169
+ },
170
+ {"t": 54, "s": [0.733]}
171
+ ],
172
+ "ix": 2,
173
+ "x": "var $bm_rt;\n$bm_rt = loopOut('cycle', 0);"
174
+ },
175
+ "w": 12,
176
+ "h": 20,
177
+ "ip": 10,
178
+ "op": 90,
179
+ "st": 10,
180
+ "bm": 0
181
+ },
182
+ {
183
+ "ddd": 0,
184
+ "ind": 2,
185
+ "ty": 0,
186
+ "nm": "Dot 0",
187
+ "refId": "comp_0",
188
+ "sr": 1,
189
+ "ks": {
190
+ "o": {"a": 0, "k": 100, "ix": 11},
191
+ "r": {"a": 0, "k": 0, "ix": 10},
192
+ "p": {"a": 0, "k": [6, 10, 0], "ix": 2},
193
+ "a": {"a": 0, "k": [-14, 10, 0], "ix": 1},
194
+ "s": {"a": 0, "k": [100, 100, 100], "ix": 6}
195
+ },
196
+ "ao": 0,
197
+ "tm": {
198
+ "a": 1,
199
+ "k": [
200
+ {
201
+ "i": {"x": [0.833], "y": [0.833]},
202
+ "o": {"x": [0.167], "y": [0.167]},
203
+ "t": 5,
204
+ "s": [0]
205
+ },
206
+ {"t": 49, "s": [0.733]}
207
+ ],
208
+ "ix": 2,
209
+ "x": "var $bm_rt;\n$bm_rt = loopOut('cycle', 0);"
210
+ },
211
+ "w": 12,
212
+ "h": 20,
213
+ "ip": 5,
214
+ "op": 85,
215
+ "st": 5,
216
+ "bm": 0
217
+ },
218
+ {
219
+ "ddd": 0,
220
+ "ind": 3,
221
+ "ty": 0,
222
+ "nm": "Dot 0",
223
+ "refId": "comp_0",
224
+ "sr": 1,
225
+ "ks": {
226
+ "o": {"a": 0, "k": 100, "ix": 11},
227
+ "r": {"a": 0, "k": 0, "ix": 10},
228
+ "p": {"a": 0, "k": [6, 10, 0], "ix": 2},
229
+ "a": {"a": 0, "k": [6, 10, 0], "ix": 1},
230
+ "s": {"a": 0, "k": [100, 100, 100], "ix": 6}
231
+ },
232
+ "ao": 0,
233
+ "tm": {
234
+ "a": 1,
235
+ "k": [
236
+ {
237
+ "i": {"x": [0.833], "y": [0.833]},
238
+ "o": {"x": [0.167], "y": [0.167]},
239
+ "t": 0,
240
+ "s": [0]
241
+ },
242
+ {"t": 44, "s": [0.733]}
243
+ ],
244
+ "ix": 2,
245
+ "x": "var $bm_rt;\n$bm_rt = loopOut('cycle', 0);"
246
+ },
247
+ "w": 12,
248
+ "h": 20,
249
+ "ip": 0,
250
+ "op": 80,
251
+ "st": 0,
252
+ "bm": 0
253
+ }
254
+ ],
255
+ "markers": []
256
+ }