@momo-kits/foundation 0.102.6-beta.4 → 0.102.6-beta.6
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.
|
@@ -35,7 +35,6 @@ import {Badge, BadgeDot} from '../Badge';
|
|
|
35
35
|
import {HeaderType} from '../Layout/types';
|
|
36
36
|
import Navigation from './Navigation';
|
|
37
37
|
import {InputRef, InputSearch, InputSearchProps} from '../Input';
|
|
38
|
-
import BadgeDotAnimation from '../Badge/BadgeDotAnimation';
|
|
39
38
|
|
|
40
39
|
const SCREEN_PADDING = 12;
|
|
41
40
|
const BACK_WIDTH = 28;
|
|
@@ -72,11 +71,6 @@ const NavigationButton: React.FC<NavigationButtonProps> = ({
|
|
|
72
71
|
if (badgeType === 'dot') {
|
|
73
72
|
return <BadgeDot size="small" style={styles.badgeDot} />;
|
|
74
73
|
}
|
|
75
|
-
if (badgeType === 'dot-animation') {
|
|
76
|
-
return (
|
|
77
|
-
<BadgeDotAnimation size="small" style={styles.badgeDotAnimation} />
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
74
|
|
|
81
75
|
if (isNumber(badgeValue)) {
|
|
82
76
|
return <Badge label={badgeValue} style={styles.badge} />;
|
|
@@ -769,11 +763,6 @@ const styles = StyleSheet.create({
|
|
|
769
763
|
top: -Spacing.XS,
|
|
770
764
|
right: -Spacing.XS,
|
|
771
765
|
},
|
|
772
|
-
badgeDotAnimation: {
|
|
773
|
-
position: 'absolute',
|
|
774
|
-
top: -Spacing.XS,
|
|
775
|
-
right: -Spacing.XS,
|
|
776
|
-
},
|
|
777
766
|
extendedHeader: {
|
|
778
767
|
aspectRatio: 1.75,
|
|
779
768
|
position: 'absolute',
|
|
@@ -8,80 +8,6 @@ import {GridSystem} from '../Layout';
|
|
|
8
8
|
import {Text} from '../Text';
|
|
9
9
|
import {Colors, Radius, Spacing} from '../Consts';
|
|
10
10
|
|
|
11
|
-
/**
|
|
12
|
-
* Empty screen for unvalidated screen name
|
|
13
|
-
* @constructor
|
|
14
|
-
*/
|
|
15
|
-
const EmptyScreen: React.FC = () => {
|
|
16
|
-
return (
|
|
17
|
-
<View
|
|
18
|
-
style={{
|
|
19
|
-
backgroundColor: Colors.black_01,
|
|
20
|
-
padding: Spacing.M,
|
|
21
|
-
borderRadius: Radius.M,
|
|
22
|
-
}}>
|
|
23
|
-
<Text typography={'header_m_bold'}>Unvalidated screen name</Text>
|
|
24
|
-
<Text
|
|
25
|
-
typography={'description_default_regular'}
|
|
26
|
-
style={{paddingVertical: Spacing.S}}>
|
|
27
|
-
Your screen has not been rendered because Platform has not detected the
|
|
28
|
-
screen name. Please migrate to support this feature.
|
|
29
|
-
</Text>
|
|
30
|
-
<Text typography={'header_default'} style={{width: '100%'}}>
|
|
31
|
-
Possible fixes:
|
|
32
|
-
</Text>
|
|
33
|
-
<View style={{marginLeft: Spacing.S}}>
|
|
34
|
-
<Text typography={'body_default_regular'}>1. Off webpack config</Text>
|
|
35
|
-
<Text typography={'body_default_regular'}>
|
|
36
|
-
2. Screen name refactoring
|
|
37
|
-
</Text>
|
|
38
|
-
<View style={{marginLeft: Spacing.S}}>
|
|
39
|
-
<Text
|
|
40
|
-
typography={'description_default_regular'}
|
|
41
|
-
style={{marginBottom: Spacing.S}}>
|
|
42
|
-
- Với các screen push/import dạng arrow function ={'>'} đổi thành
|
|
43
|
-
named function
|
|
44
|
-
</Text>
|
|
45
|
-
<Text
|
|
46
|
-
typography={'description_default_regular'}
|
|
47
|
-
style={{marginBottom: Spacing.S}}>
|
|
48
|
-
- Với các screen import dạng High Order Component ={'>'} rename
|
|
49
|
-
generic function thành named function
|
|
50
|
-
</Text>
|
|
51
|
-
<Text
|
|
52
|
-
typography={'description_default_regular'}
|
|
53
|
-
style={{marginBottom: Spacing.S}}>
|
|
54
|
-
- Với Tab Navigator, Platform sẽ lấy Tab Container làm screen name.
|
|
55
|
-
Trong trường hợp miniapp muốn track riêng action cho từng tab, tham
|
|
56
|
-
khảo theo docs
|
|
57
|
-
</Text>
|
|
58
|
-
</View>
|
|
59
|
-
</View>
|
|
60
|
-
<Text typography={'header_s_semibold'}>More information: </Text>
|
|
61
|
-
<Text
|
|
62
|
-
typography={'body_default_regular'}
|
|
63
|
-
color={Colors.blue_01}
|
|
64
|
-
onPress={() => {
|
|
65
|
-
Linking.openURL(
|
|
66
|
-
'https://gitlab.mservice.com.vn/momo-platform/mini-app/-/tree/vn.momo.uikits/dev/app'
|
|
67
|
-
);
|
|
68
|
-
}}>
|
|
69
|
-
Mini App: vn.momo.uikits/dev
|
|
70
|
-
</Text>
|
|
71
|
-
<Text
|
|
72
|
-
typography={'body_default_regular'}
|
|
73
|
-
color={Colors.blue_01}
|
|
74
|
-
onPress={() => {
|
|
75
|
-
Linking.openURL(
|
|
76
|
-
'https://docs.google.com/presentation/d/1bIFoh8gRXb6hsnGJz4O1Kxg4_oNikB1KuuEt2wULCDM/edit?usp=sharing'
|
|
77
|
-
);
|
|
78
|
-
}}>
|
|
79
|
-
https://docs.google.com/presentation/d/1bIFoh8gRXb6hsnGJz4O1Kxg4_oNikB1KuuEt2wULCDM/edit?usp=sharing
|
|
80
|
-
</Text>
|
|
81
|
-
</View>
|
|
82
|
-
);
|
|
83
|
-
};
|
|
84
|
-
|
|
85
11
|
/**
|
|
86
12
|
* container for stack screen
|
|
87
13
|
* @param props
|
|
@@ -99,8 +25,6 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
99
25
|
traceIdInteraction: undefined,
|
|
100
26
|
releaseLoad: undefined,
|
|
101
27
|
releaseInteraction: undefined,
|
|
102
|
-
timeoutLoad: undefined,
|
|
103
|
-
timeoutInteraction: undefined,
|
|
104
28
|
});
|
|
105
29
|
const interaction = useRef<any>();
|
|
106
30
|
const context = useContext<any>(MiniAppContext);
|
|
@@ -135,15 +59,6 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
135
59
|
};
|
|
136
60
|
}
|
|
137
61
|
navigation.setOptions(defaultOptions);
|
|
138
|
-
navigator?.maxApi?.startTraceScreenLoad?.(screenName, (data: any) => {
|
|
139
|
-
tracked.current.traceIdLoad = data?.traceId;
|
|
140
|
-
});
|
|
141
|
-
navigator?.maxApi?.startTraceScreenInteraction?.(
|
|
142
|
-
screenName,
|
|
143
|
-
(data: any) => {
|
|
144
|
-
tracked.current.traceIdInteraction = data?.traceId;
|
|
145
|
-
}
|
|
146
|
-
);
|
|
147
62
|
}, [options]);
|
|
148
63
|
|
|
149
64
|
/**
|
|
@@ -156,16 +71,22 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
156
71
|
}, 300);
|
|
157
72
|
}
|
|
158
73
|
navigator?.maxApi?.of?.({screenName});
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
165
|
-
|
|
74
|
+
navigator?.maxApi?.getDataObserver('CURRENT_SCREEN', (data: string) => {
|
|
75
|
+
if (data) {
|
|
76
|
+
Alert.alert('getDataObserver', data);
|
|
77
|
+
}
|
|
78
|
+
navigator?.maxApi?.setObserver('CURRENT_SCREEN', screenName);
|
|
79
|
+
});
|
|
80
|
+
navigator?.maxApi?.startTraceScreenLoad?.(screenName, (data: any) => {
|
|
81
|
+
tracked.current.traceIdLoad = data?.traceId;
|
|
82
|
+
});
|
|
83
|
+
navigator?.maxApi?.startTraceScreenInteraction?.(
|
|
84
|
+
screenName,
|
|
85
|
+
(data: any) => {
|
|
86
|
+
tracked.current.traceIdInteraction = data?.traceId;
|
|
87
|
+
}
|
|
88
|
+
);
|
|
166
89
|
return () => {
|
|
167
|
-
clearTimeout(tracked.current.timeoutLoad);
|
|
168
|
-
clearTimeout(tracked.current.timeoutInteraction);
|
|
169
90
|
onScreenLoad();
|
|
170
91
|
onScreenInteraction();
|
|
171
92
|
};
|
|
@@ -201,8 +122,9 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
201
122
|
* debug
|
|
202
123
|
*/
|
|
203
124
|
navigator?.maxApi?.showToastDebug?.({
|
|
204
|
-
appId:
|
|
125
|
+
appId: context.appId,
|
|
205
126
|
message: `${screenName} screen_load_time ${timeLoad.current}`,
|
|
127
|
+
type: 'ERROR',
|
|
206
128
|
});
|
|
207
129
|
if (timeLoad.current <= 0 && context.enableAutoId) {
|
|
208
130
|
Alert.alert(screenName, "Can't get screen load time");
|
|
@@ -242,8 +164,9 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
242
164
|
* debug toast
|
|
243
165
|
*/
|
|
244
166
|
navigator?.maxApi?.showToastDebug?.({
|
|
245
|
-
appId:
|
|
167
|
+
appId: context.appId,
|
|
246
168
|
message: `${screenName} screen_interaction_time ${timeInteraction.current}`,
|
|
169
|
+
type: 'ERROR',
|
|
247
170
|
});
|
|
248
171
|
if (timeInteraction.current <= 0 && context.enableAutoId) {
|
|
249
172
|
Alert.alert(screenName, "Can't get screen interaction time");
|
|
@@ -266,6 +189,8 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
266
189
|
if (timeLoad.current === 0) {
|
|
267
190
|
timeLoad.current = endTime.current - startTime.current;
|
|
268
191
|
}
|
|
192
|
+
onScreenLoad();
|
|
193
|
+
onScreenInteraction();
|
|
269
194
|
}, 2000);
|
|
270
195
|
},
|
|
271
196
|
}}>
|
|
@@ -280,4 +205,78 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
280
205
|
);
|
|
281
206
|
};
|
|
282
207
|
|
|
208
|
+
/**
|
|
209
|
+
* Empty screen for unvalidated screen name
|
|
210
|
+
* @constructor
|
|
211
|
+
*/
|
|
212
|
+
const EmptyScreen: React.FC = () => {
|
|
213
|
+
return (
|
|
214
|
+
<View
|
|
215
|
+
style={{
|
|
216
|
+
backgroundColor: Colors.black_01,
|
|
217
|
+
padding: Spacing.M,
|
|
218
|
+
borderRadius: Radius.M,
|
|
219
|
+
}}>
|
|
220
|
+
<Text typography={'header_m_bold'}>Unvalidated screen name</Text>
|
|
221
|
+
<Text
|
|
222
|
+
typography={'description_default_regular'}
|
|
223
|
+
style={{paddingVertical: Spacing.S}}>
|
|
224
|
+
Your screen has not been rendered because Platform has not detected the
|
|
225
|
+
screen name. Please migrate to support this feature.
|
|
226
|
+
</Text>
|
|
227
|
+
<Text typography={'header_default'} style={{width: '100%'}}>
|
|
228
|
+
Possible fixes:
|
|
229
|
+
</Text>
|
|
230
|
+
<View style={{marginLeft: Spacing.S}}>
|
|
231
|
+
<Text typography={'body_default_regular'}>1. Off webpack config</Text>
|
|
232
|
+
<Text typography={'body_default_regular'}>
|
|
233
|
+
2. Screen name refactoring
|
|
234
|
+
</Text>
|
|
235
|
+
<View style={{marginLeft: Spacing.S}}>
|
|
236
|
+
<Text
|
|
237
|
+
typography={'description_default_regular'}
|
|
238
|
+
style={{marginBottom: Spacing.S}}>
|
|
239
|
+
- Với các screen push/import dạng arrow function ={'>'} đổi thành
|
|
240
|
+
named function
|
|
241
|
+
</Text>
|
|
242
|
+
<Text
|
|
243
|
+
typography={'description_default_regular'}
|
|
244
|
+
style={{marginBottom: Spacing.S}}>
|
|
245
|
+
- Với các screen import dạng High Order Component ={'>'} rename
|
|
246
|
+
generic function thành named function
|
|
247
|
+
</Text>
|
|
248
|
+
<Text
|
|
249
|
+
typography={'description_default_regular'}
|
|
250
|
+
style={{marginBottom: Spacing.S}}>
|
|
251
|
+
- Với Tab Navigator, Platform sẽ lấy Tab Container làm screen name.
|
|
252
|
+
Trong trường hợp miniapp muốn track riêng action cho từng tab, tham
|
|
253
|
+
khảo theo docs
|
|
254
|
+
</Text>
|
|
255
|
+
</View>
|
|
256
|
+
</View>
|
|
257
|
+
<Text typography={'header_s_semibold'}>More information: </Text>
|
|
258
|
+
<Text
|
|
259
|
+
typography={'body_default_regular'}
|
|
260
|
+
color={Colors.blue_01}
|
|
261
|
+
onPress={() => {
|
|
262
|
+
Linking.openURL(
|
|
263
|
+
'https://gitlab.mservice.com.vn/momo-platform/mini-app/-/tree/vn.momo.uikits/dev/app'
|
|
264
|
+
);
|
|
265
|
+
}}>
|
|
266
|
+
Mini App: vn.momo.uikits/dev
|
|
267
|
+
</Text>
|
|
268
|
+
<Text
|
|
269
|
+
typography={'body_default_regular'}
|
|
270
|
+
color={Colors.blue_01}
|
|
271
|
+
onPress={() => {
|
|
272
|
+
Linking.openURL(
|
|
273
|
+
'https://docs.google.com/presentation/d/1bIFoh8gRXb6hsnGJz4O1Kxg4_oNikB1KuuEt2wULCDM/edit?usp=sharing'
|
|
274
|
+
);
|
|
275
|
+
}}>
|
|
276
|
+
https://docs.google.com/presentation/d/1bIFoh8gRXb6hsnGJz4O1Kxg4_oNikB1KuuEt2wULCDM/edit?usp=sharing
|
|
277
|
+
</Text>
|
|
278
|
+
</View>
|
|
279
|
+
);
|
|
280
|
+
};
|
|
281
|
+
|
|
283
282
|
export default StackScreen;
|
package/Application/types.ts
CHANGED
|
@@ -129,7 +129,7 @@ export type NavigationButtonProps = {
|
|
|
129
129
|
tintColor?: string;
|
|
130
130
|
useBorder?: boolean;
|
|
131
131
|
onPress: () => void;
|
|
132
|
-
badgeType?: 'dot' | 'number'
|
|
132
|
+
badgeType?: 'dot' | 'number';
|
|
133
133
|
badgeValue?: number;
|
|
134
134
|
accessibilityLabel?: string;
|
|
135
135
|
};
|
|
@@ -137,7 +137,7 @@ export type NavigationButtonProps = {
|
|
|
137
137
|
export type PinnedToolType = {
|
|
138
138
|
key: string;
|
|
139
139
|
badgeValue?: number;
|
|
140
|
-
badgeType?: 'number' | 'dot'
|
|
140
|
+
badgeType?: 'number' | 'dot';
|
|
141
141
|
};
|
|
142
142
|
|
|
143
143
|
export type RuntimeToolType = {
|
|
@@ -27,7 +27,7 @@ const BadgeDotAnimation = ({size, style}: BadgeDotProps) => {
|
|
|
27
27
|
useNativeDriver: true,
|
|
28
28
|
}),
|
|
29
29
|
Animated.spring(scaleAnim, {
|
|
30
|
-
toValue: 1.
|
|
30
|
+
toValue: 1.1,
|
|
31
31
|
friction: 5,
|
|
32
32
|
tension: 30,
|
|
33
33
|
useNativeDriver: true,
|
|
@@ -36,7 +36,7 @@ const BadgeDotAnimation = ({size, style}: BadgeDotProps) => {
|
|
|
36
36
|
Animated.sequence([
|
|
37
37
|
Animated.timing(waveScaleAnim, {
|
|
38
38
|
toValue: 2.5,
|
|
39
|
-
duration: DURATION *
|
|
39
|
+
duration: DURATION * 3,
|
|
40
40
|
useNativeDriver: true,
|
|
41
41
|
}),
|
|
42
42
|
Animated.timing(waveScaleAnim, {
|
|
@@ -48,7 +48,7 @@ const BadgeDotAnimation = ({size, style}: BadgeDotProps) => {
|
|
|
48
48
|
Animated.sequence([
|
|
49
49
|
Animated.timing(waveOpacityAnim, {
|
|
50
50
|
toValue: 0.3, // Wave becomes visible
|
|
51
|
-
duration: DURATION *
|
|
51
|
+
duration: DURATION * 2,
|
|
52
52
|
useNativeDriver: true,
|
|
53
53
|
}),
|
|
54
54
|
Animated.timing(waveOpacityAnim, {
|
|
@@ -64,7 +64,7 @@ const BadgeDotAnimation = ({size, style}: BadgeDotProps) => {
|
|
|
64
64
|
return () => {
|
|
65
65
|
animation.stop();
|
|
66
66
|
};
|
|
67
|
-
}, [
|
|
67
|
+
}, []);
|
|
68
68
|
|
|
69
69
|
return (
|
|
70
70
|
<View style={[styles.container, style]}>
|