@momo-kits/foundation 0.102.6-beta.7 → 0.102.6-beta.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/Application/Components.tsx +0 -11
- package/Application/StackScreen.tsx +139 -131
- package/Application/types.ts +2 -2
- package/Badge/BadgeDotAnimation.tsx +32 -5
- package/Badge/index.tsx +1 -2
- package/Badge/styles.ts +6 -50
- package/package.json +1 -1
|
@@ -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';
|
|
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
|
|
@@ -89,20 +15,19 @@ const EmptyScreen: React.FC = () => {
|
|
|
89
15
|
*/
|
|
90
16
|
const StackScreen: React.FC<ScreenParams> = props => {
|
|
91
17
|
const {showGrid, navigator} = useContext(ApplicationContext);
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
const tracked = useRef<any>({
|
|
18
|
+
const tracking = useRef<any>({
|
|
19
|
+
timeoutLoad: undefined,
|
|
20
|
+
interaction: undefined,
|
|
21
|
+
startTime: Date.now(),
|
|
22
|
+
endTime: Date.now(),
|
|
98
23
|
traceIdLoad: undefined,
|
|
99
24
|
traceIdInteraction: undefined,
|
|
100
25
|
releaseLoad: undefined,
|
|
101
26
|
releaseInteraction: undefined,
|
|
102
|
-
|
|
103
|
-
|
|
27
|
+
timeLoad: 0,
|
|
28
|
+
timeInteraction: 0,
|
|
104
29
|
});
|
|
105
|
-
|
|
30
|
+
|
|
106
31
|
const context = useContext<any>(MiniAppContext);
|
|
107
32
|
const {screen: Component, options, initialParams} = props.route.params;
|
|
108
33
|
const navigation = new Navigation(props.navigation);
|
|
@@ -135,15 +60,6 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
135
60
|
};
|
|
136
61
|
}
|
|
137
62
|
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
63
|
}, [options]);
|
|
148
64
|
|
|
149
65
|
/**
|
|
@@ -156,16 +72,25 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
156
72
|
}, 300);
|
|
157
73
|
}
|
|
158
74
|
navigator?.maxApi?.of?.({screenName});
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
75
|
+
props.navigation?.addListener?.('focus', () => {
|
|
76
|
+
navigator?.maxApi?.getDataObserver('CURRENT_SCREEN', (data: any) => {
|
|
77
|
+
if (data) {
|
|
78
|
+
Alert.alert('getDataObserver', JSON.stringify(data));
|
|
79
|
+
}
|
|
80
|
+
navigator?.maxApi?.setObserver('CURRENT_SCREEN', {screenName});
|
|
81
|
+
});
|
|
82
|
+
});
|
|
165
83
|
|
|
84
|
+
navigator?.maxApi?.startTraceScreenLoad?.(screenName, (data: any) => {
|
|
85
|
+
tracking.current.traceIdLoad = data?.traceId;
|
|
86
|
+
});
|
|
87
|
+
navigator?.maxApi?.startTraceScreenInteraction?.(
|
|
88
|
+
screenName,
|
|
89
|
+
(data: any) => {
|
|
90
|
+
tracking.current.traceIdInteraction = data?.traceId;
|
|
91
|
+
}
|
|
92
|
+
);
|
|
166
93
|
return () => {
|
|
167
|
-
clearTimeout(tracked.current.timeoutLoad);
|
|
168
|
-
clearTimeout(tracked.current.timeoutInteraction);
|
|
169
94
|
onScreenLoad();
|
|
170
95
|
onScreenInteraction();
|
|
171
96
|
};
|
|
@@ -175,9 +100,10 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
175
100
|
* tracking for screen load
|
|
176
101
|
*/
|
|
177
102
|
const onScreenLoad = () => {
|
|
178
|
-
if (!
|
|
179
|
-
if (
|
|
180
|
-
|
|
103
|
+
if (!tracking.current?.releaseLoad) {
|
|
104
|
+
if (tracking.current.timeLoad === 0) {
|
|
105
|
+
tracking.current.timeLoad =
|
|
106
|
+
tracking.current.endTime - tracking.current.startTime;
|
|
181
107
|
}
|
|
182
108
|
|
|
183
109
|
context.autoTracking?.({
|
|
@@ -188,23 +114,24 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
188
114
|
action: 'push',
|
|
189
115
|
componentName: 'Screen',
|
|
190
116
|
state: 'load',
|
|
191
|
-
duration:
|
|
117
|
+
duration: tracking.current.timeLoad,
|
|
192
118
|
});
|
|
193
119
|
navigator?.maxApi?.stopTrace?.(
|
|
194
|
-
|
|
195
|
-
{value:
|
|
120
|
+
tracking.current.traceIdLoad,
|
|
121
|
+
{value: tracking.current.timeLoad / 1000},
|
|
196
122
|
null
|
|
197
123
|
);
|
|
198
|
-
|
|
124
|
+
tracking.current.releaseLoad = true;
|
|
199
125
|
|
|
200
126
|
/**
|
|
201
127
|
* debug
|
|
202
128
|
*/
|
|
203
129
|
navigator?.maxApi?.showToastDebug?.({
|
|
204
|
-
appId:
|
|
205
|
-
message: `${screenName} screen_load_time ${
|
|
130
|
+
appId: context.appId,
|
|
131
|
+
message: `${screenName} screen_load_time ${tracking.current.timeLoad}`,
|
|
132
|
+
type: 'ERROR',
|
|
206
133
|
});
|
|
207
|
-
if (
|
|
134
|
+
if (tracking.current.timeLoad <= 0 && context.enableAutoId) {
|
|
208
135
|
Alert.alert(screenName, "Can't get screen load time");
|
|
209
136
|
}
|
|
210
137
|
}
|
|
@@ -214,12 +141,13 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
214
141
|
* tracking for screen load
|
|
215
142
|
*/
|
|
216
143
|
const onScreenInteraction = () => {
|
|
217
|
-
if (!
|
|
218
|
-
if (
|
|
219
|
-
|
|
144
|
+
if (!tracking.current?.releaseInteraction) {
|
|
145
|
+
if (tracking.current.timeLoad === 0) {
|
|
146
|
+
tracking.current.timeLoad =
|
|
147
|
+
tracking.current.endTime - tracking.current.startTime;
|
|
220
148
|
}
|
|
221
|
-
if (
|
|
222
|
-
|
|
149
|
+
if (tracking.current.timeInteraction === 0) {
|
|
150
|
+
tracking.current.timeInteraction = tracking.current.timeLoad;
|
|
223
151
|
}
|
|
224
152
|
|
|
225
153
|
context.autoTracking?.({
|
|
@@ -229,23 +157,24 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
229
157
|
screenName,
|
|
230
158
|
componentName: 'Screen',
|
|
231
159
|
state: 'interaction',
|
|
232
|
-
duration:
|
|
160
|
+
duration: tracking.current.timeInteraction - tracking.current.timeLoad,
|
|
233
161
|
});
|
|
234
162
|
navigator?.maxApi?.stopTrace?.(
|
|
235
|
-
|
|
236
|
-
{value:
|
|
163
|
+
tracking.current.traceIdInteraction,
|
|
164
|
+
{value: tracking.current.timeInteraction / 1000},
|
|
237
165
|
null
|
|
238
166
|
);
|
|
239
|
-
|
|
167
|
+
tracking.current.releaseInteraction = true;
|
|
240
168
|
|
|
241
169
|
/**
|
|
242
170
|
* debug toast
|
|
243
171
|
*/
|
|
244
172
|
navigator?.maxApi?.showToastDebug?.({
|
|
245
|
-
appId:
|
|
246
|
-
message: `${screenName} screen_interaction_time ${
|
|
173
|
+
appId: context.appId,
|
|
174
|
+
message: `${screenName} screen_interaction_time ${tracking.current.timeInteraction}`,
|
|
175
|
+
type: 'ERROR',
|
|
247
176
|
});
|
|
248
|
-
if (
|
|
177
|
+
if (tracking.current.timeInteraction <= 0 && context.enableAutoId) {
|
|
249
178
|
Alert.alert(screenName, "Can't get screen interaction time");
|
|
250
179
|
}
|
|
251
180
|
}
|
|
@@ -256,16 +185,21 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
256
185
|
value={{
|
|
257
186
|
screenName,
|
|
258
187
|
onElementLoad: () => {
|
|
259
|
-
clearTimeout(
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
188
|
+
clearTimeout(tracking.current.timeoutLoad);
|
|
189
|
+
tracking.current.endTime = Date.now();
|
|
190
|
+
tracking.current.interaction?.cancel?.();
|
|
191
|
+
tracking.current.interaction =
|
|
192
|
+
InteractionManager.runAfterInteractions(() => {
|
|
193
|
+
tracking.current.timeInteraction =
|
|
194
|
+
Date.now() - tracking.current.startTime;
|
|
195
|
+
});
|
|
196
|
+
tracking.current.timeoutLoad = setTimeout(() => {
|
|
197
|
+
if (tracking.current.timeLoad === 0) {
|
|
198
|
+
tracking.current.timeLoad =
|
|
199
|
+
tracking.current.endTime - tracking.current.startTime;
|
|
268
200
|
}
|
|
201
|
+
onScreenLoad();
|
|
202
|
+
onScreenInteraction();
|
|
269
203
|
}, 2000);
|
|
270
204
|
},
|
|
271
205
|
}}>
|
|
@@ -280,4 +214,78 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
280
214
|
);
|
|
281
215
|
};
|
|
282
216
|
|
|
217
|
+
/**
|
|
218
|
+
* Empty screen for unvalidated screen name
|
|
219
|
+
* @constructor
|
|
220
|
+
*/
|
|
221
|
+
const EmptyScreen: React.FC = () => {
|
|
222
|
+
return (
|
|
223
|
+
<View
|
|
224
|
+
style={{
|
|
225
|
+
backgroundColor: Colors.black_01,
|
|
226
|
+
padding: Spacing.M,
|
|
227
|
+
borderRadius: Radius.M,
|
|
228
|
+
}}>
|
|
229
|
+
<Text typography={'header_m_bold'}>Unvalidated screen name</Text>
|
|
230
|
+
<Text
|
|
231
|
+
typography={'description_default_regular'}
|
|
232
|
+
style={{paddingVertical: Spacing.S}}>
|
|
233
|
+
Your screen has not been rendered because Platform has not detected the
|
|
234
|
+
screen name. Please migrate to support this feature.
|
|
235
|
+
</Text>
|
|
236
|
+
<Text typography={'header_default'} style={{width: '100%'}}>
|
|
237
|
+
Possible fixes:
|
|
238
|
+
</Text>
|
|
239
|
+
<View style={{marginLeft: Spacing.S}}>
|
|
240
|
+
<Text typography={'body_default_regular'}>1. Off webpack config</Text>
|
|
241
|
+
<Text typography={'body_default_regular'}>
|
|
242
|
+
2. Screen name refactoring
|
|
243
|
+
</Text>
|
|
244
|
+
<View style={{marginLeft: Spacing.S}}>
|
|
245
|
+
<Text
|
|
246
|
+
typography={'description_default_regular'}
|
|
247
|
+
style={{marginBottom: Spacing.S}}>
|
|
248
|
+
- Với các screen push/import dạng arrow function ={'>'} đổi thành
|
|
249
|
+
named function
|
|
250
|
+
</Text>
|
|
251
|
+
<Text
|
|
252
|
+
typography={'description_default_regular'}
|
|
253
|
+
style={{marginBottom: Spacing.S}}>
|
|
254
|
+
- Với các screen import dạng High Order Component ={'>'} rename
|
|
255
|
+
generic function thành named function
|
|
256
|
+
</Text>
|
|
257
|
+
<Text
|
|
258
|
+
typography={'description_default_regular'}
|
|
259
|
+
style={{marginBottom: Spacing.S}}>
|
|
260
|
+
- Với Tab Navigator, Platform sẽ lấy Tab Container làm screen name.
|
|
261
|
+
Trong trường hợp miniapp muốn track riêng action cho từng tab, tham
|
|
262
|
+
khảo theo docs
|
|
263
|
+
</Text>
|
|
264
|
+
</View>
|
|
265
|
+
</View>
|
|
266
|
+
<Text typography={'header_s_semibold'}>More information: </Text>
|
|
267
|
+
<Text
|
|
268
|
+
typography={'body_default_regular'}
|
|
269
|
+
color={Colors.blue_01}
|
|
270
|
+
onPress={() => {
|
|
271
|
+
Linking.openURL(
|
|
272
|
+
'https://gitlab.mservice.com.vn/momo-platform/mini-app/-/tree/vn.momo.uikits/dev/app'
|
|
273
|
+
);
|
|
274
|
+
}}>
|
|
275
|
+
Mini App: vn.momo.uikits/dev
|
|
276
|
+
</Text>
|
|
277
|
+
<Text
|
|
278
|
+
typography={'body_default_regular'}
|
|
279
|
+
color={Colors.blue_01}
|
|
280
|
+
onPress={() => {
|
|
281
|
+
Linking.openURL(
|
|
282
|
+
'https://docs.google.com/presentation/d/1bIFoh8gRXb6hsnGJz4O1Kxg4_oNikB1KuuEt2wULCDM/edit?usp=sharing'
|
|
283
|
+
);
|
|
284
|
+
}}>
|
|
285
|
+
https://docs.google.com/presentation/d/1bIFoh8gRXb6hsnGJz4O1Kxg4_oNikB1KuuEt2wULCDM/edit?usp=sharing
|
|
286
|
+
</Text>
|
|
287
|
+
</View>
|
|
288
|
+
);
|
|
289
|
+
};
|
|
290
|
+
|
|
283
291
|
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 = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, {useEffect, useRef} from 'react';
|
|
2
|
-
import {Animated, View} from 'react-native';
|
|
2
|
+
import {Animated, StyleSheet, View} from 'react-native';
|
|
3
3
|
import {BadgeDotProps} from './types';
|
|
4
|
-
import
|
|
4
|
+
import CommonStyle from './styles';
|
|
5
5
|
|
|
6
6
|
const DURATION = 500;
|
|
7
7
|
|
|
@@ -11,8 +11,7 @@ const BadgeDotAnimation = ({size, style}: BadgeDotProps) => {
|
|
|
11
11
|
const waveScaleAnim = useRef(new Animated.Value(1)).current;
|
|
12
12
|
const waveOpacityAnim = useRef(new Animated.Value(0)).current;
|
|
13
13
|
|
|
14
|
-
const dotStyle =
|
|
15
|
-
size === 'small' ? styles.dotAnimationSmall : styles.dotAnimation;
|
|
14
|
+
const dotStyle = size === 'small' ? styles.dotSmall : styles.dot;
|
|
16
15
|
const waveStyle = size === 'small' ? styles.waveSmall : styles.wave;
|
|
17
16
|
|
|
18
17
|
useEffect(() => {
|
|
@@ -68,7 +67,7 @@ const BadgeDotAnimation = ({size, style}: BadgeDotProps) => {
|
|
|
68
67
|
}, []);
|
|
69
68
|
|
|
70
69
|
return (
|
|
71
|
-
<View style={[styles.
|
|
70
|
+
<View style={[styles.container, style]}>
|
|
72
71
|
{/* Wave Animation */}
|
|
73
72
|
<Animated.View
|
|
74
73
|
style={[
|
|
@@ -92,4 +91,32 @@ const BadgeDotAnimation = ({size, style}: BadgeDotProps) => {
|
|
|
92
91
|
);
|
|
93
92
|
};
|
|
94
93
|
|
|
94
|
+
const styles = StyleSheet.create({
|
|
95
|
+
...CommonStyle,
|
|
96
|
+
container: {
|
|
97
|
+
position: 'relative',
|
|
98
|
+
alignItems: 'center',
|
|
99
|
+
justifyContent: 'center',
|
|
100
|
+
},
|
|
101
|
+
dot: {
|
|
102
|
+
...CommonStyle.dot,
|
|
103
|
+
borderWidth: 0,
|
|
104
|
+
},
|
|
105
|
+
dotSmall: {
|
|
106
|
+
...CommonStyle.dotSmall,
|
|
107
|
+
borderWidth: 0,
|
|
108
|
+
},
|
|
109
|
+
wave: {
|
|
110
|
+
...CommonStyle.dot,
|
|
111
|
+
opacity: 0,
|
|
112
|
+
position: 'absolute',
|
|
113
|
+
borderWidth: 0,
|
|
114
|
+
},
|
|
115
|
+
waveSmall: {
|
|
116
|
+
...CommonStyle.dotSmall,
|
|
117
|
+
borderWidth: 0,
|
|
118
|
+
position: 'absolute',
|
|
119
|
+
},
|
|
120
|
+
});
|
|
121
|
+
|
|
95
122
|
export default BadgeDotAnimation;
|
package/Badge/index.tsx
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import Badge from './Badge';
|
|
2
2
|
import BadgeDot from './BadgeDot';
|
|
3
3
|
import BadgeRibbon from './BadgeRibbon';
|
|
4
|
-
import BadgeDotAnimation from './BadgeDotAnimation';
|
|
5
4
|
import {BadgeProps, BadgeDotProps, BadgeRibbonProps} from './types';
|
|
6
5
|
|
|
7
|
-
export {Badge, BadgeRibbon, BadgeDot
|
|
6
|
+
export {Badge, BadgeRibbon, BadgeDot};
|
|
8
7
|
export type {BadgeProps, BadgeDotProps, BadgeRibbonProps};
|
package/Badge/styles.ts
CHANGED
|
@@ -2,10 +2,6 @@ import {StyleSheet} from 'react-native';
|
|
|
2
2
|
import {Colors, Radius, Spacing} from '../Consts';
|
|
3
3
|
import {scaleSize} from '../Text';
|
|
4
4
|
|
|
5
|
-
const DOT_SIZE = 16;
|
|
6
|
-
|
|
7
|
-
const DOT_SMALL_SIZE = 10;
|
|
8
|
-
|
|
9
5
|
export default StyleSheet.create({
|
|
10
6
|
badge: {
|
|
11
7
|
paddingHorizontal: Spacing.XS,
|
|
@@ -19,61 +15,21 @@ export default StyleSheet.create({
|
|
|
19
15
|
borderColor: Colors.black_01,
|
|
20
16
|
alignSelf: 'baseline',
|
|
21
17
|
},
|
|
22
|
-
dotAnimationContainer: {
|
|
23
|
-
position: 'relative',
|
|
24
|
-
alignItems: 'center',
|
|
25
|
-
justifyContent: 'center',
|
|
26
|
-
},
|
|
27
18
|
dot: {
|
|
28
|
-
width:
|
|
29
|
-
height:
|
|
19
|
+
width: 16,
|
|
20
|
+
height: 16,
|
|
30
21
|
borderWidth: 2,
|
|
31
22
|
borderColor: Colors.black_01,
|
|
32
23
|
backgroundColor: Colors.red_03,
|
|
33
|
-
borderRadius:
|
|
24
|
+
borderRadius: 8,
|
|
34
25
|
},
|
|
35
26
|
dotSmall: {
|
|
36
|
-
width:
|
|
37
|
-
height:
|
|
27
|
+
width: 10,
|
|
28
|
+
height: 10,
|
|
38
29
|
borderWidth: 1,
|
|
39
30
|
borderColor: Colors.black_01,
|
|
40
31
|
backgroundColor: Colors.red_03,
|
|
41
|
-
borderRadius:
|
|
42
|
-
},
|
|
43
|
-
dotAnimation: {
|
|
44
|
-
width: DOT_SIZE,
|
|
45
|
-
height: DOT_SIZE,
|
|
46
|
-
borderColor: Colors.black_01,
|
|
47
|
-
backgroundColor: Colors.red_03,
|
|
48
|
-
borderRadius: DOT_SIZE / 2,
|
|
49
|
-
borderWidth: 0,
|
|
50
|
-
},
|
|
51
|
-
dotAnimationSmall: {
|
|
52
|
-
width: DOT_SMALL_SIZE,
|
|
53
|
-
height: DOT_SMALL_SIZE,
|
|
54
|
-
borderColor: Colors.black_01,
|
|
55
|
-
backgroundColor: Colors.red_03,
|
|
56
|
-
borderRadius: DOT_SMALL_SIZE / 2,
|
|
57
|
-
borderWidth: 0,
|
|
58
|
-
},
|
|
59
|
-
wave: {
|
|
60
|
-
width: DOT_SIZE,
|
|
61
|
-
height: DOT_SIZE,
|
|
62
|
-
borderColor: Colors.black_01,
|
|
63
|
-
backgroundColor: Colors.red_03,
|
|
64
|
-
borderRadius: DOT_SIZE / 2,
|
|
65
|
-
opacity: 0,
|
|
66
|
-
position: 'absolute',
|
|
67
|
-
borderWidth: 0,
|
|
68
|
-
},
|
|
69
|
-
waveSmall: {
|
|
70
|
-
width: DOT_SMALL_SIZE,
|
|
71
|
-
height: DOT_SMALL_SIZE,
|
|
72
|
-
borderColor: Colors.black_01,
|
|
73
|
-
backgroundColor: Colors.red_03,
|
|
74
|
-
borderRadius: DOT_SMALL_SIZE / 2,
|
|
75
|
-
borderWidth: 0,
|
|
76
|
-
position: 'absolute',
|
|
32
|
+
borderRadius: 5,
|
|
77
33
|
},
|
|
78
34
|
ribbon: {
|
|
79
35
|
alignSelf: 'baseline',
|