@momo-kits/foundation 0.81.25 → 0.81.27-beta.1
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/Application/Components.tsx +11 -0
- package/Application/StackScreen.tsx +14 -0
- package/Badge/Badge.tsx +1 -1
- package/Badge/styles.ts +2 -4
- package/Layout/Screen.tsx +76 -19
- package/Layout/styles.ts +16 -3
- package/Layout/types.ts +2 -0
- package/package.json +1 -1
|
@@ -183,6 +183,17 @@ const HeaderLeft: React.FC<HeaderBackProps> = ({
|
|
|
183
183
|
const canGoBack = navigator?.ref.current?.canGoBack();
|
|
184
184
|
if (!canGoBack && navigator?.trackingInfo) {
|
|
185
185
|
const currentRoute = navigator?.ref?.current.getCurrentRoute();
|
|
186
|
+
alert(
|
|
187
|
+
JSON.stringify({
|
|
188
|
+
feature_code: navigator.trackingInfo.code,
|
|
189
|
+
app_id: navigator.trackingInfo.appId,
|
|
190
|
+
miniapp_version: navigator.trackingInfo.buildNumber,
|
|
191
|
+
flow_partner_id: navigator.trackingInfo.flowPartnerId,
|
|
192
|
+
screen_name: currentRoute?.params?.screen?.name ?? currentRoute?.name,
|
|
193
|
+
trigger_id: '111154000000000000',
|
|
194
|
+
icon_name: 'back',
|
|
195
|
+
}),
|
|
196
|
+
);
|
|
186
197
|
navigator?.maxApi?.trackEvent('service_icon_clicked', {
|
|
187
198
|
feature_code: navigator.trackingInfo.code,
|
|
188
199
|
app_id: navigator.trackingInfo.appId,
|
|
@@ -47,6 +47,13 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
47
47
|
pre_screen_name = routes[routesLength - 2]?.params?.screen?.name;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
alert(
|
|
51
|
+
JSON.stringify({
|
|
52
|
+
...tracking,
|
|
53
|
+
pre_screen_name,
|
|
54
|
+
trigger_id: '111378000000000000',
|
|
55
|
+
}),
|
|
56
|
+
);
|
|
50
57
|
navigator?.maxApi?.trackEvent('service_frame_displayed', {
|
|
51
58
|
...tracking,
|
|
52
59
|
pre_screen_name,
|
|
@@ -54,6 +61,13 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
54
61
|
});
|
|
55
62
|
|
|
56
63
|
return props.navigation.addListener('beforeRemove', () => {
|
|
64
|
+
alert(
|
|
65
|
+
JSON.stringify({
|
|
66
|
+
...tracking,
|
|
67
|
+
trigger_id: '111154000000000000',
|
|
68
|
+
icon_name: 'back',
|
|
69
|
+
}),
|
|
70
|
+
);
|
|
57
71
|
navigator?.maxApi?.trackEvent('service_icon_clicked', {
|
|
58
72
|
...tracking,
|
|
59
73
|
trigger_id: '111154000000000000',
|
package/Badge/Badge.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import {View} from 'react-native';
|
|
|
4
4
|
import {ApplicationContext} from '../Application';
|
|
5
5
|
import {BadgeProps} from './types';
|
|
6
6
|
import styles from './styles';
|
|
7
|
-
import {Colors} from '../Consts';
|
|
7
|
+
import {Colors, Spacing} from '../Consts';
|
|
8
8
|
import {Text} from '../Text';
|
|
9
9
|
|
|
10
10
|
const Badge: FC<BadgeProps> = ({label = 'Label', style, backgroundColor}) => {
|
package/Badge/styles.ts
CHANGED
|
@@ -4,15 +4,13 @@ import {scaleSize} from '../Text';
|
|
|
4
4
|
|
|
5
5
|
export default StyleSheet.create({
|
|
6
6
|
badge: {
|
|
7
|
-
paddingHorizontal: Spacing.XS,
|
|
8
7
|
borderRadius: Radius.M,
|
|
9
8
|
justifyContent: 'center',
|
|
10
|
-
alignItems: 'center',
|
|
11
9
|
height: scaleSize(16),
|
|
12
10
|
flexDirection: 'row',
|
|
13
|
-
borderWidth: 1,
|
|
14
11
|
borderColor: Colors.black_01,
|
|
15
|
-
|
|
12
|
+
paddingHorizontal: Spacing.XS,
|
|
13
|
+
alignItems: 'center',
|
|
16
14
|
},
|
|
17
15
|
dot: {
|
|
18
16
|
width: 16,
|
package/Layout/Screen.tsx
CHANGED
|
@@ -28,6 +28,7 @@ import Navigation from '../Application/Navigation';
|
|
|
28
28
|
import styles from './styles';
|
|
29
29
|
import {AnimatedHeader, NavigationOptions} from '../Application/types';
|
|
30
30
|
import {Image} from '../Image';
|
|
31
|
+
import {HeaderType} from './types';
|
|
31
32
|
|
|
32
33
|
export interface ScreenProps extends ViewProps {
|
|
33
34
|
children: React.ReactNode;
|
|
@@ -47,9 +48,9 @@ export interface ScreenProps extends ViewProps {
|
|
|
47
48
|
scrollable?: boolean;
|
|
48
49
|
|
|
49
50
|
/**
|
|
50
|
-
* Optional.
|
|
51
|
+
* Optional. Set type of header.
|
|
51
52
|
*/
|
|
52
|
-
|
|
53
|
+
headerType?: HeaderType;
|
|
53
54
|
|
|
54
55
|
/**
|
|
55
56
|
* Optional. Props for the animated component or bool used top navigation animated.
|
|
@@ -89,13 +90,13 @@ const Screen = forwardRef(
|
|
|
89
90
|
enableKeyboardAvoidingView = false,
|
|
90
91
|
scrollable = false,
|
|
91
92
|
navigation,
|
|
92
|
-
useExtendedHeader,
|
|
93
93
|
animatedHeader,
|
|
94
94
|
scrollViewProps,
|
|
95
95
|
headerComponent: Header,
|
|
96
96
|
footerComponent: Footer,
|
|
97
97
|
layoutOffset = -56,
|
|
98
98
|
backgroundColor,
|
|
99
|
+
headerType = 'default',
|
|
99
100
|
}: ScreenProps,
|
|
100
101
|
ref,
|
|
101
102
|
) => {
|
|
@@ -111,23 +112,14 @@ const Screen = forwardRef(
|
|
|
111
112
|
let keyboardVerticalOffset = heightHeader - 20;
|
|
112
113
|
animatedValue.current = undefined;
|
|
113
114
|
|
|
114
|
-
if (
|
|
115
|
+
if (headerType == 'extended' || animatedHeader) {
|
|
115
116
|
keyboardVerticalOffset = -20;
|
|
116
117
|
}
|
|
117
118
|
|
|
118
|
-
if (
|
|
119
|
+
if (headerType == 'extended') {
|
|
119
120
|
headerBackground = theme.assets?.headerBackground;
|
|
120
121
|
}
|
|
121
122
|
|
|
122
|
-
useEffect(() => {
|
|
123
|
-
if (useExtendedHeader) {
|
|
124
|
-
navigation?.setOptions({
|
|
125
|
-
headerTransparent: true,
|
|
126
|
-
headerBackground: () => null,
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
}, [useExtendedHeader]);
|
|
130
|
-
|
|
131
123
|
useEffect(() => {
|
|
132
124
|
if (animatedHeader) {
|
|
133
125
|
styleAnimatedHeader = {
|
|
@@ -168,6 +160,69 @@ const Screen = forwardRef(
|
|
|
168
160
|
}
|
|
169
161
|
}, [animatedHeader]);
|
|
170
162
|
|
|
163
|
+
useEffect(() => {
|
|
164
|
+
if (!animatedHeader) {
|
|
165
|
+
let headerOptions: NavigationOptions = {};
|
|
166
|
+
switch (headerType) {
|
|
167
|
+
case 'none':
|
|
168
|
+
headerOptions = {
|
|
169
|
+
headerTransparent: true,
|
|
170
|
+
headerBackground: () => null,
|
|
171
|
+
headerShown: false,
|
|
172
|
+
};
|
|
173
|
+
break;
|
|
174
|
+
|
|
175
|
+
case 'surface':
|
|
176
|
+
headerOptions = {
|
|
177
|
+
headerTransparent: false,
|
|
178
|
+
headerShown: true,
|
|
179
|
+
headerTintColor: theme.colors.text.default,
|
|
180
|
+
headerBackground: (props: any) => (
|
|
181
|
+
<HeaderBackground
|
|
182
|
+
{...props}
|
|
183
|
+
image={null}
|
|
184
|
+
backgroundColor={theme.colors.background.surface}
|
|
185
|
+
useBorder={true}
|
|
186
|
+
animatedValue={animatedValue.current}
|
|
187
|
+
/>
|
|
188
|
+
),
|
|
189
|
+
headerTitle: (props: any) => (
|
|
190
|
+
<HeaderTitle {...props} animatedValue={animatedValue.current} />
|
|
191
|
+
),
|
|
192
|
+
};
|
|
193
|
+
break;
|
|
194
|
+
|
|
195
|
+
case 'extended':
|
|
196
|
+
headerOptions = {
|
|
197
|
+
headerShown: true,
|
|
198
|
+
headerTransparent: true,
|
|
199
|
+
headerTintColor: Colors.black_01,
|
|
200
|
+
headerBackground: () => null,
|
|
201
|
+
headerTitle: (props: any) => <HeaderTitle {...props} />,
|
|
202
|
+
};
|
|
203
|
+
break;
|
|
204
|
+
|
|
205
|
+
default:
|
|
206
|
+
headerOptions = {
|
|
207
|
+
headerTransparent: false,
|
|
208
|
+
headerShown: true,
|
|
209
|
+
headerTintColor: Colors.black_01,
|
|
210
|
+
headerBackground: (props: any) => <HeaderBackground {...props} />,
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
navigation?.setOptions(headerOptions);
|
|
215
|
+
const current: any = navigation;
|
|
216
|
+
const parent = current?.getParent?.();
|
|
217
|
+
if (parent) {
|
|
218
|
+
return current?.addListener?.('focus', () => {
|
|
219
|
+
const stackNavigation = new Navigation(parent, theme);
|
|
220
|
+
stackNavigation?.setOptions(headerOptions);
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}, [headerType]);
|
|
225
|
+
|
|
171
226
|
/**
|
|
172
227
|
* animated when use scroll && animated value
|
|
173
228
|
*/
|
|
@@ -292,11 +347,13 @@ const Screen = forwardRef(
|
|
|
292
347
|
</Component>
|
|
293
348
|
{Footer && (
|
|
294
349
|
<View
|
|
295
|
-
style={
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
350
|
+
style={[
|
|
351
|
+
styles.footerContainer,
|
|
352
|
+
{
|
|
353
|
+
paddingBottom: Math.min(insets.bottom, 21) + Spacing.S,
|
|
354
|
+
backgroundColor: theme.colors.background.surface,
|
|
355
|
+
},
|
|
356
|
+
]}>
|
|
300
357
|
<Section>{Footer}</Section>
|
|
301
358
|
</View>
|
|
302
359
|
)}
|
package/Layout/styles.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {StyleSheet} from 'react-native';
|
|
2
|
-
import {Radius} from '../Consts';
|
|
1
|
+
import {Platform, StyleSheet} from 'react-native';
|
|
2
|
+
import {Colors, Radius, Spacing} from '../Consts';
|
|
3
3
|
|
|
4
4
|
export default StyleSheet.create({
|
|
5
5
|
extendedHeader: {
|
|
@@ -45,7 +45,6 @@ export default StyleSheet.create({
|
|
|
45
45
|
flexDirection: 'row',
|
|
46
46
|
flexWrap: 'wrap',
|
|
47
47
|
borderRadius: Radius.M,
|
|
48
|
-
|
|
49
48
|
padding: 12,
|
|
50
49
|
},
|
|
51
50
|
item: {
|
|
@@ -81,4 +80,18 @@ export default StyleSheet.create({
|
|
|
81
80
|
paddingHorizontal: undefined,
|
|
82
81
|
paddingVertical: undefined,
|
|
83
82
|
},
|
|
83
|
+
footerContainer: {
|
|
84
|
+
paddingTop: Spacing.S,
|
|
85
|
+
...Platform.select({
|
|
86
|
+
android: {
|
|
87
|
+
elevation: 4,
|
|
88
|
+
},
|
|
89
|
+
ios: {
|
|
90
|
+
shadowColor: Colors.black_20,
|
|
91
|
+
shadowOffset: {width: 0, height: -2},
|
|
92
|
+
shadowOpacity: 0.1,
|
|
93
|
+
shadowRadius: 3,
|
|
94
|
+
},
|
|
95
|
+
}),
|
|
96
|
+
},
|
|
84
97
|
});
|
package/Layout/types.ts
CHANGED