@momo-kits/foundation 0.81.43-beta.9 → 0.81.43-rc.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.
- package/Application/BottomTab.tsx +26 -10
- package/Application/Components.tsx +109 -145
- package/Application/types.ts +1 -0
- package/Badge/Badge.tsx +1 -1
- package/Badge/styles.ts +1 -0
- package/Layout/Card.tsx +8 -8
- package/Layout/ItemList.tsx +39 -33
- package/Layout/Section.tsx +4 -3
- package/Text/index.tsx +2 -1
- package/Text/styles.ts +38 -0
- package/Text/types.ts +18 -24
- package/package.json +1 -1
- package/verify.js +3 -2
|
@@ -3,29 +3,45 @@ import {Platform} from 'react-native';
|
|
|
3
3
|
import {BottomTabProps, NavigationScreenProps} from './types';
|
|
4
4
|
import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';
|
|
5
5
|
import {createStackNavigator} from '@react-navigation/stack';
|
|
6
|
+
import {useSafeAreaInsets} from 'react-native-safe-area-context';
|
|
7
|
+
import {NavigationContainer} from '@react-navigation/native';
|
|
6
8
|
import {Icon} from '../Icon';
|
|
7
9
|
import {Text} from '../Text';
|
|
8
10
|
import {ApplicationContext} from './index';
|
|
9
11
|
import {getStackOptions} from './utils';
|
|
10
12
|
import StackScreen from './StackScreen';
|
|
11
|
-
import {useSafeAreaInsets} from 'react-native-safe-area-context';
|
|
12
13
|
|
|
13
14
|
const Tab = createBottomTabNavigator();
|
|
14
15
|
const Stack = createStackNavigator();
|
|
15
16
|
|
|
16
17
|
const TabScreen: React.FC<NavigationScreenProps> = ({route}) => {
|
|
18
|
+
if (route.params?.nested) {
|
|
19
|
+
return (
|
|
20
|
+
<Stack.Navigator>
|
|
21
|
+
<Stack.Screen
|
|
22
|
+
name="Stack"
|
|
23
|
+
component={StackScreen}
|
|
24
|
+
initialParams={{screen: route.params?.screen}}
|
|
25
|
+
options={{...getStackOptions(), ...route.params?.options}}
|
|
26
|
+
/>
|
|
27
|
+
</Stack.Navigator>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
17
30
|
return (
|
|
18
|
-
<
|
|
19
|
-
<Stack.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
31
|
+
<NavigationContainer independent={true}>
|
|
32
|
+
<Stack.Navigator>
|
|
33
|
+
<Stack.Screen
|
|
34
|
+
name="Stack"
|
|
35
|
+
component={StackScreen}
|
|
36
|
+
initialParams={{screen: route.params?.screen}}
|
|
37
|
+
options={{...getStackOptions(), ...route.params?.options}}
|
|
38
|
+
/>
|
|
39
|
+
</Stack.Navigator>
|
|
40
|
+
</NavigationContainer>
|
|
26
41
|
);
|
|
27
42
|
};
|
|
28
43
|
const BottomTab: React.FC<BottomTabProps> = ({
|
|
44
|
+
nested,
|
|
29
45
|
tabs,
|
|
30
46
|
listeners,
|
|
31
47
|
navigation,
|
|
@@ -61,7 +77,7 @@ const BottomTab: React.FC<BottomTabProps> = ({
|
|
|
61
77
|
key={item.name}
|
|
62
78
|
name={item.name}
|
|
63
79
|
component={TabScreen}
|
|
64
|
-
initialParams={item}
|
|
80
|
+
initialParams={{...item, nested}}
|
|
65
81
|
listeners={listeners}
|
|
66
82
|
options={{
|
|
67
83
|
tabBarLabel: ({color, focused}) => {
|
|
@@ -31,74 +31,6 @@ import {Icon} from '../Icon';
|
|
|
31
31
|
import {PopupNotify} from '../Popup';
|
|
32
32
|
import {Badge, BadgeDot} from '../Badge';
|
|
33
33
|
|
|
34
|
-
const styles = StyleSheet.create({
|
|
35
|
-
navigationButton: {
|
|
36
|
-
height: 28,
|
|
37
|
-
width: 28,
|
|
38
|
-
borderRadius: 14,
|
|
39
|
-
justifyContent: 'center',
|
|
40
|
-
alignItems: 'center',
|
|
41
|
-
},
|
|
42
|
-
headerBackground: {
|
|
43
|
-
width: '100%',
|
|
44
|
-
height: undefined,
|
|
45
|
-
position: 'absolute',
|
|
46
|
-
aspectRatio: 375 / 154,
|
|
47
|
-
},
|
|
48
|
-
headerTitleContainer: {
|
|
49
|
-
alignItems: 'center',
|
|
50
|
-
justifyContent: 'center',
|
|
51
|
-
width: '100%',
|
|
52
|
-
},
|
|
53
|
-
circle: {width: 36, height: 36, borderRadius: 18},
|
|
54
|
-
square: {width: 36, height: 36, borderRadius: Radius.XS},
|
|
55
|
-
dotAvatar: {
|
|
56
|
-
position: 'absolute',
|
|
57
|
-
width: 12,
|
|
58
|
-
height: 12,
|
|
59
|
-
borderRadius: 6,
|
|
60
|
-
bottom: 0,
|
|
61
|
-
right: 0,
|
|
62
|
-
borderWidth: 1,
|
|
63
|
-
borderColor: Colors.black_01,
|
|
64
|
-
},
|
|
65
|
-
headerButton: {paddingHorizontal: 4},
|
|
66
|
-
headerRightButton: {
|
|
67
|
-
flexDirection: 'row',
|
|
68
|
-
justifyContent: 'center',
|
|
69
|
-
alignItems: 'center',
|
|
70
|
-
paddingRight: Spacing.S,
|
|
71
|
-
},
|
|
72
|
-
toolkitContainer: {
|
|
73
|
-
marginLeft: Spacing.S,
|
|
74
|
-
padding: Spacing.XS,
|
|
75
|
-
height: 28,
|
|
76
|
-
borderRadius: 14,
|
|
77
|
-
borderColor: '#00000066',
|
|
78
|
-
justifyContent: 'center',
|
|
79
|
-
alignItems: 'center',
|
|
80
|
-
flexDirection: 'row',
|
|
81
|
-
},
|
|
82
|
-
divider: {
|
|
83
|
-
width: 1,
|
|
84
|
-
height: 12,
|
|
85
|
-
marginHorizontal: 4,
|
|
86
|
-
},
|
|
87
|
-
headerLeft: {
|
|
88
|
-
marginLeft: 12,
|
|
89
|
-
},
|
|
90
|
-
title: {
|
|
91
|
-
fontSize: scaleSize(15),
|
|
92
|
-
lineHeight: scaleSize(22),
|
|
93
|
-
fontWeight: 'bold',
|
|
94
|
-
},
|
|
95
|
-
badge: {
|
|
96
|
-
position: 'absolute',
|
|
97
|
-
top: -8,
|
|
98
|
-
right: -6,
|
|
99
|
-
},
|
|
100
|
-
});
|
|
101
|
-
|
|
102
34
|
const NavigationButton: React.FC<NavigationButtonProps> = ({
|
|
103
35
|
icon,
|
|
104
36
|
tintColor,
|
|
@@ -119,25 +51,29 @@ const NavigationButton: React.FC<NavigationButtonProps> = ({
|
|
|
119
51
|
}
|
|
120
52
|
|
|
121
53
|
const renderBadge = useCallback(() => {
|
|
122
|
-
if (!badgeValue && !badgeType) return null;
|
|
123
54
|
if (badgeType === 'dot') {
|
|
124
|
-
return <BadgeDot size="small" style={styles.
|
|
55
|
+
return <BadgeDot size="small" style={styles.badgeDot} />;
|
|
125
56
|
}
|
|
57
|
+
|
|
58
|
+
if (isNaN(Number(badgeValue))) return null;
|
|
59
|
+
|
|
126
60
|
return <Badge label={badgeValue} style={styles.badge} />;
|
|
127
61
|
}, [badgeType, badgeValue]);
|
|
128
62
|
|
|
129
63
|
return (
|
|
130
|
-
<
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
64
|
+
<View style={{width: scaleSize(28)}}>
|
|
65
|
+
<TouchableOpacity
|
|
66
|
+
accessibilityLabel={`NavigationButton/${accessibilityLabel}`}
|
|
67
|
+
style={[styles.navigationButton, buttonStyle]}
|
|
68
|
+
onPress={onPress}>
|
|
69
|
+
<Icon
|
|
70
|
+
source={icon}
|
|
71
|
+
color={tintColor ?? theme.colors.text.default}
|
|
72
|
+
size={20}
|
|
73
|
+
/>
|
|
74
|
+
</TouchableOpacity>
|
|
139
75
|
{renderBadge()}
|
|
140
|
-
</
|
|
76
|
+
</View>
|
|
141
77
|
);
|
|
142
78
|
};
|
|
143
79
|
|
|
@@ -349,12 +285,12 @@ const HeaderRightAction: React.FC<any> = ({children, ...restProps}) => {
|
|
|
349
285
|
|
|
350
286
|
const HeaderToolkitAction: React.FC<any> = ({
|
|
351
287
|
tintColor,
|
|
352
|
-
pinnedTool
|
|
288
|
+
pinnedTool,
|
|
353
289
|
preventBack,
|
|
354
290
|
}) => {
|
|
355
291
|
const {theme, navigator} = useContext(ApplicationContext);
|
|
356
292
|
const [toolConfig, setToolConfig] = useState<any>();
|
|
357
|
-
const {
|
|
293
|
+
const {onAction} = toolConfig ?? {};
|
|
358
294
|
|
|
359
295
|
let backgroundColor;
|
|
360
296
|
if (tintColor != Colors.black_01) {
|
|
@@ -365,71 +301,26 @@ const HeaderToolkitAction: React.FC<any> = ({
|
|
|
365
301
|
if (navigator?.toolkitConfig) {
|
|
366
302
|
setToolConfig(navigator?.toolkitConfig);
|
|
367
303
|
} else {
|
|
368
|
-
|
|
369
|
-
navigator.toolkitConfig = {
|
|
370
|
-
configs: [
|
|
371
|
-
...config?.miniappTools?.customTools,
|
|
372
|
-
...config?.defaultTools,
|
|
373
|
-
],
|
|
374
|
-
appCode: config?.appCode,
|
|
375
|
-
};
|
|
376
|
-
setToolConfig({
|
|
377
|
-
configs: [
|
|
378
|
-
...config?.miniappTools?.customTools,
|
|
379
|
-
...config?.defaultTools,
|
|
380
|
-
],
|
|
381
|
-
appCode: config?.appCode,
|
|
382
|
-
});
|
|
383
|
-
});
|
|
304
|
+
getToolkitConfig();
|
|
384
305
|
}
|
|
385
306
|
}, []);
|
|
386
307
|
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
addFavorite = navigator?.requestApi(
|
|
394
|
-
'observer',
|
|
395
|
-
[addSchema],
|
|
396
|
-
(data: any) => {
|
|
397
|
-
if (data?.status) {
|
|
398
|
-
setToolConfig({
|
|
399
|
-
...(toolConfig as HeaderToolkitProps),
|
|
400
|
-
hidden: true,
|
|
401
|
-
});
|
|
402
|
-
}
|
|
403
|
-
},
|
|
404
|
-
);
|
|
405
|
-
addFavorite = navigator?.requestApi(
|
|
406
|
-
'observer',
|
|
407
|
-
[removeSchema],
|
|
408
|
-
(data: any) => {
|
|
409
|
-
if (data?.status) {
|
|
410
|
-
setToolConfig({
|
|
411
|
-
...(toolConfig as HeaderToolkitProps),
|
|
412
|
-
hidden: false,
|
|
413
|
-
});
|
|
414
|
-
}
|
|
415
|
-
},
|
|
416
|
-
);
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
return () => {
|
|
420
|
-
addFavorite?.();
|
|
421
|
-
removeFavorite?.();
|
|
422
|
-
};
|
|
423
|
-
}, [appCode]);
|
|
308
|
+
const getToolkitConfig = () => {
|
|
309
|
+
navigator?.requestApi('getToolsConfig', [undefined], (config: any) => {
|
|
310
|
+
navigator.toolkitConfig = config;
|
|
311
|
+
setToolConfig(navigator?.toolkitConfig);
|
|
312
|
+
});
|
|
313
|
+
};
|
|
424
314
|
|
|
425
315
|
const onMore = () => {
|
|
426
316
|
onAction?.('onMore');
|
|
427
317
|
navigator?.requestApi(
|
|
428
318
|
'showTools',
|
|
429
|
-
[
|
|
319
|
+
[undefined],
|
|
430
320
|
(res: {item: {action?: string; key: string}}) => {
|
|
431
321
|
const {item} = res;
|
|
432
322
|
navigator?.toolkitCallback?.(item);
|
|
323
|
+
getToolkitConfig();
|
|
433
324
|
},
|
|
434
325
|
);
|
|
435
326
|
};
|
|
@@ -456,23 +347,23 @@ const HeaderToolkitAction: React.FC<any> = ({
|
|
|
456
347
|
};
|
|
457
348
|
|
|
458
349
|
const renderPinnedTool = () => {
|
|
459
|
-
const
|
|
460
|
-
|
|
461
|
-
|
|
350
|
+
const pinKey = pinnedTool?.key || toolConfig?.pinnedTool?.key;
|
|
351
|
+
const pinTool = toolConfig?.tools?.find((i: any) => i.key === pinKey);
|
|
352
|
+
const {badgeValue, badgeType} = pinnedTool ?? {};
|
|
462
353
|
|
|
463
|
-
|
|
464
|
-
const {icon} = pinTool || '';
|
|
465
|
-
|
|
466
|
-
if (pinTool && pinnedTool)
|
|
354
|
+
if (pinTool)
|
|
467
355
|
return (
|
|
468
356
|
<NavigationButton
|
|
469
357
|
accessibilityLabel={'UtilityTool'}
|
|
470
|
-
icon={icon as string}
|
|
358
|
+
icon={pinTool.icon as string}
|
|
471
359
|
tintColor={tintColor}
|
|
472
360
|
badgeValue={badgeValue}
|
|
473
361
|
badgeType={badgeType}
|
|
474
362
|
onPress={() => {
|
|
475
|
-
navigator?.
|
|
363
|
+
navigator?.requestApi('onToolAction', [pinTool?.key], () => {
|
|
364
|
+
getToolkitConfig();
|
|
365
|
+
});
|
|
366
|
+
navigator?.toolkitCallback?.(pinTool.key);
|
|
476
367
|
}}
|
|
477
368
|
/>
|
|
478
369
|
);
|
|
@@ -553,6 +444,79 @@ const HeaderAnimated: React.FC<HeaderAnimatedProps> = ({
|
|
|
553
444
|
);
|
|
554
445
|
};
|
|
555
446
|
|
|
447
|
+
const styles = StyleSheet.create({
|
|
448
|
+
navigationButton: {
|
|
449
|
+
height: 28,
|
|
450
|
+
width: 28,
|
|
451
|
+
borderRadius: 14,
|
|
452
|
+
justifyContent: 'center',
|
|
453
|
+
alignItems: 'center',
|
|
454
|
+
},
|
|
455
|
+
headerBackground: {
|
|
456
|
+
width: '100%',
|
|
457
|
+
height: undefined,
|
|
458
|
+
position: 'absolute',
|
|
459
|
+
aspectRatio: 375 / 154,
|
|
460
|
+
},
|
|
461
|
+
headerTitleContainer: {
|
|
462
|
+
alignItems: 'center',
|
|
463
|
+
justifyContent: 'center',
|
|
464
|
+
width: '100%',
|
|
465
|
+
},
|
|
466
|
+
circle: {width: 36, height: 36, borderRadius: 18},
|
|
467
|
+
square: {width: 36, height: 36, borderRadius: Radius.XS},
|
|
468
|
+
dotAvatar: {
|
|
469
|
+
position: 'absolute',
|
|
470
|
+
width: 12,
|
|
471
|
+
height: 12,
|
|
472
|
+
borderRadius: 6,
|
|
473
|
+
bottom: 0,
|
|
474
|
+
right: 0,
|
|
475
|
+
borderWidth: 1,
|
|
476
|
+
borderColor: Colors.black_01,
|
|
477
|
+
},
|
|
478
|
+
headerButton: {paddingHorizontal: 4},
|
|
479
|
+
headerRightButton: {
|
|
480
|
+
flexDirection: 'row',
|
|
481
|
+
justifyContent: 'center',
|
|
482
|
+
alignItems: 'center',
|
|
483
|
+
paddingRight: Spacing.S,
|
|
484
|
+
},
|
|
485
|
+
toolkitContainer: {
|
|
486
|
+
marginLeft: Spacing.S,
|
|
487
|
+
padding: Spacing.XS,
|
|
488
|
+
height: 28,
|
|
489
|
+
borderRadius: 14,
|
|
490
|
+
borderColor: '#00000066',
|
|
491
|
+
justifyContent: 'center',
|
|
492
|
+
alignItems: 'center',
|
|
493
|
+
flexDirection: 'row',
|
|
494
|
+
},
|
|
495
|
+
divider: {
|
|
496
|
+
width: 1,
|
|
497
|
+
height: 12,
|
|
498
|
+
marginHorizontal: 4,
|
|
499
|
+
},
|
|
500
|
+
headerLeft: {
|
|
501
|
+
marginLeft: 12,
|
|
502
|
+
},
|
|
503
|
+
title: {
|
|
504
|
+
fontSize: scaleSize(15),
|
|
505
|
+
lineHeight: scaleSize(22),
|
|
506
|
+
fontWeight: 'bold',
|
|
507
|
+
},
|
|
508
|
+
badge: {
|
|
509
|
+
position: 'absolute',
|
|
510
|
+
top: -Spacing.S,
|
|
511
|
+
right: -6,
|
|
512
|
+
},
|
|
513
|
+
badgeDot: {
|
|
514
|
+
position: 'absolute',
|
|
515
|
+
top: -Spacing.XS,
|
|
516
|
+
right: -Spacing.XS,
|
|
517
|
+
},
|
|
518
|
+
});
|
|
519
|
+
|
|
556
520
|
export {
|
|
557
521
|
NavigationButton,
|
|
558
522
|
HeaderTitle,
|
package/Application/types.ts
CHANGED
package/Badge/Badge.tsx
CHANGED
|
@@ -47,7 +47,7 @@ const Badge: FC<BadgeProps> = ({label = 'Label', style, backgroundColor}) => {
|
|
|
47
47
|
return (
|
|
48
48
|
<View style={[style, styles.badge, {backgroundColor: badgeColor}]}>
|
|
49
49
|
<Text color={Colors.black_01} typography={'action_xxs'}>
|
|
50
|
-
{formatTitle()}
|
|
50
|
+
{formatTitle()}
|
|
51
51
|
</Text>
|
|
52
52
|
</View>
|
|
53
53
|
);
|
package/Badge/styles.ts
CHANGED
package/Layout/Card.tsx
CHANGED
|
@@ -29,7 +29,7 @@ const Card: React.FC<CardProps> = ({
|
|
|
29
29
|
useShadow = false,
|
|
30
30
|
...props
|
|
31
31
|
}) => {
|
|
32
|
-
const {showGrid} = useContext(ApplicationContext);
|
|
32
|
+
const {showGrid, theme} = useContext(ApplicationContext);
|
|
33
33
|
const {numberOfColumns} = useGridSystem();
|
|
34
34
|
|
|
35
35
|
const gutterSize = 8;
|
|
@@ -47,6 +47,7 @@ const Card: React.FC<CardProps> = ({
|
|
|
47
47
|
return span * sizePerSpan + (span - 1) * gutterSize;
|
|
48
48
|
},
|
|
49
49
|
};
|
|
50
|
+
|
|
50
51
|
/**
|
|
51
52
|
* render overlay only dev mode
|
|
52
53
|
*/
|
|
@@ -107,8 +108,9 @@ const Card: React.FC<CardProps> = ({
|
|
|
107
108
|
if (Array.isArray(children)) {
|
|
108
109
|
let cursor = 0;
|
|
109
110
|
let rows: any[] = [];
|
|
110
|
-
|
|
111
|
-
|
|
111
|
+
const arrayChild = children.filter(item => !!item);
|
|
112
|
+
for (let i = 0; i < arrayChild.length; ++i) {
|
|
113
|
+
const item = arrayChild[i];
|
|
112
114
|
const totalSpan = rows
|
|
113
115
|
.concat([item])
|
|
114
116
|
.map(i => i.props?.widthSpan)
|
|
@@ -124,7 +126,7 @@ const Card: React.FC<CardProps> = ({
|
|
|
124
126
|
rows = [item];
|
|
125
127
|
}
|
|
126
128
|
|
|
127
|
-
if (i ==
|
|
129
|
+
if (i == arrayChild.length - 1) {
|
|
128
130
|
cursor += 1;
|
|
129
131
|
element.push(addRowView(rows, cursor, true));
|
|
130
132
|
}
|
|
@@ -138,23 +140,21 @@ const Card: React.FC<CardProps> = ({
|
|
|
138
140
|
return element;
|
|
139
141
|
};
|
|
140
142
|
|
|
141
|
-
const {theme} = useContext(ApplicationContext);
|
|
142
143
|
return (
|
|
143
144
|
<GridContext.Provider value={gridContext}>
|
|
144
145
|
<View
|
|
145
146
|
{...props}
|
|
146
147
|
accessibilityLabel={`Card`}
|
|
147
148
|
style={[
|
|
149
|
+
{backgroundColor: theme.colors.background.surface},
|
|
148
150
|
style,
|
|
149
151
|
styles.protectedStyle,
|
|
150
152
|
styles.card,
|
|
151
153
|
{
|
|
152
154
|
width: widthSection,
|
|
153
155
|
marginHorizontal: margin,
|
|
154
|
-
backgroundColor: backgroundImage
|
|
155
|
-
? undefined
|
|
156
|
-
: theme.colors.background.surface,
|
|
157
156
|
},
|
|
157
|
+
!!backgroundImage && {backgroundColor: undefined},
|
|
158
158
|
useShadow && Shadow.Light,
|
|
159
159
|
]}>
|
|
160
160
|
{!!backgroundImage && (
|
package/Layout/ItemList.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, {forwardRef, useContext} from 'react';
|
|
2
2
|
import {FlatList, FlatListProps, View} from 'react-native';
|
|
3
3
|
import Item, {SpanNumber} from './Item';
|
|
4
4
|
import {GridContext} from './index';
|
|
@@ -11,39 +11,45 @@ export interface ItemListProps extends FlatListProps<any> {
|
|
|
11
11
|
widthSpan?: SpanNumber;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
const ItemList
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
14
|
+
const ItemList = forwardRef(
|
|
15
|
+
(
|
|
16
|
+
{
|
|
17
|
+
renderItem,
|
|
18
|
+
widthSpan,
|
|
19
|
+
style,
|
|
20
|
+
contentContainerStyle,
|
|
21
|
+
...props
|
|
22
|
+
}: ItemListProps,
|
|
23
|
+
ref,
|
|
24
|
+
) => {
|
|
25
|
+
const {gutterSize, numberOfColumns} = useContext(GridContext);
|
|
26
|
+
const widthItem = (widthSpan ?? numberOfColumns) as SpanNumber;
|
|
27
|
+
const numColumns = Math.floor(numberOfColumns / widthItem);
|
|
28
|
+
const indexBegin = props?.data?.map((_i, index) => index * numColumns);
|
|
29
|
+
const _renderItem = (item: any) => {
|
|
30
|
+
if (indexBegin?.includes(item?.index)) {
|
|
31
|
+
return <Item widthSpan={widthItem}>{renderItem?.(item)}</Item>;
|
|
32
|
+
}
|
|
33
|
+
return (
|
|
34
|
+
<View style={{paddingLeft: gutterSize}}>
|
|
35
|
+
<Item widthSpan={widthItem}>{renderItem?.(item)}</Item>
|
|
36
|
+
</View>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
|
|
29
40
|
return (
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
|
|
41
|
+
<FlatList
|
|
42
|
+
ref={ref as React.RefObject<FlatList>}
|
|
43
|
+
{...props}
|
|
44
|
+
numColumns={numColumns}
|
|
45
|
+
renderItem={_renderItem}
|
|
46
|
+
horizontal={false}
|
|
47
|
+
ItemSeparatorComponent={() => <View style={{height: gutterSize}} />}
|
|
48
|
+
style={[style, styles.protectedStyle]}
|
|
49
|
+
contentContainerStyle={[contentContainerStyle, styles.protectedStyle]}
|
|
50
|
+
/>
|
|
33
51
|
);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return (
|
|
37
|
-
<FlatList
|
|
38
|
-
{...props}
|
|
39
|
-
numColumns={numColumns}
|
|
40
|
-
renderItem={_renderItem}
|
|
41
|
-
horizontal={false}
|
|
42
|
-
ItemSeparatorComponent={() => <View style={{height: gutterSize}} />}
|
|
43
|
-
style={[style, styles.protectedStyle]}
|
|
44
|
-
contentContainerStyle={[contentContainerStyle, styles.protectedStyle]}
|
|
45
|
-
/>
|
|
46
|
-
);
|
|
47
|
-
};
|
|
52
|
+
},
|
|
53
|
+
);
|
|
48
54
|
|
|
49
55
|
export default ItemList;
|
package/Layout/Section.tsx
CHANGED
|
@@ -107,8 +107,9 @@ const Section: React.FC<SectionProps> = ({
|
|
|
107
107
|
if (Array.isArray(children)) {
|
|
108
108
|
let cursor = 0;
|
|
109
109
|
let rows: any[] = [];
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
const arrayChild = children.filter(item => !!item);
|
|
111
|
+
for (let i = 0; i < arrayChild.length; ++i) {
|
|
112
|
+
const item = arrayChild[i];
|
|
112
113
|
const totalSpan = rows
|
|
113
114
|
.concat([item])
|
|
114
115
|
.map(i => i.props?.widthSpan)
|
|
@@ -124,7 +125,7 @@ const Section: React.FC<SectionProps> = ({
|
|
|
124
125
|
rows = [item];
|
|
125
126
|
}
|
|
126
127
|
|
|
127
|
-
if (i ==
|
|
128
|
+
if (i == arrayChild.length - 1) {
|
|
128
129
|
cursor += 1;
|
|
129
130
|
element.push(addRowView(rows, cursor, true));
|
|
130
131
|
}
|
package/Text/index.tsx
CHANGED
|
@@ -84,6 +84,7 @@ const Text: React.FC<TextProps> = ({
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
return {
|
|
87
|
+
...typoStyle,
|
|
87
88
|
fontFamily,
|
|
88
89
|
fontSize: scaleSize(fontSize),
|
|
89
90
|
lineHeight: scaleSize(lineHeight),
|
|
@@ -104,7 +105,7 @@ const Text: React.FC<TextProps> = ({
|
|
|
104
105
|
};
|
|
105
106
|
|
|
106
107
|
Text.defaultProps = {
|
|
107
|
-
typography: '
|
|
108
|
+
typography: 'body_default_regular',
|
|
108
109
|
};
|
|
109
110
|
|
|
110
111
|
export {Text, scaleSize};
|
package/Text/styles.ts
CHANGED
|
@@ -1,4 +1,42 @@
|
|
|
1
1
|
export default {
|
|
2
|
+
headline_default_bold: {fontSize: 24, lineHeight: 32, fontWeight: '700'},
|
|
3
|
+
header_m_bold: {fontSize: 18, lineHeight: 28, fontWeight: '700'},
|
|
4
|
+
header_default_bold: {fontSize: 16, lineHeight: 22, fontWeight: '700'},
|
|
5
|
+
header_s_semibold: {fontSize: 14, lineHeight: 20, fontWeight: '600'},
|
|
6
|
+
header_xs_semibold: {fontSize: 12, lineHeight: 16, fontWeight: '600'},
|
|
7
|
+
body_default_regular: {fontSize: 14, lineHeight: 20, fontWeight: '400'},
|
|
8
|
+
body_default_regularstrikethrought: {
|
|
9
|
+
fontSize: 14,
|
|
10
|
+
lineHeight: 20,
|
|
11
|
+
fontWeight: '400',
|
|
12
|
+
textDecorationLine: 'line-through',
|
|
13
|
+
},
|
|
14
|
+
description_default_regular: {
|
|
15
|
+
fontSize: 12,
|
|
16
|
+
lineHeight: 16,
|
|
17
|
+
fontWeight: '400',
|
|
18
|
+
},
|
|
19
|
+
description_default_regularstrikethrought: {
|
|
20
|
+
fontSize: 12,
|
|
21
|
+
lineHeight: 16,
|
|
22
|
+
fontWeight: '400',
|
|
23
|
+
textDecorationLine: 'line-through',
|
|
24
|
+
},
|
|
25
|
+
description_xs_regular: {fontSize: 10, lineHeight: 14, fontWeight: '400'},
|
|
26
|
+
description_xs_regularstrikethrought: {
|
|
27
|
+
fontSize: 10,
|
|
28
|
+
lineHeight: 14,
|
|
29
|
+
fontWeight: '400',
|
|
30
|
+
textDecorationLine: 'line-through',
|
|
31
|
+
},
|
|
32
|
+
label_default_medium: {fontSize: 14, lineHeight: 20, fontWeight: '500'},
|
|
33
|
+
label_s_medium: {fontSize: 12, lineHeight: 16, fontWeight: '500'},
|
|
34
|
+
label_xs_medium: {fontSize: 10, lineHeight: 14, fontWeight: '500'},
|
|
35
|
+
action_default_bold: {fontSize: 16, lineHeight: 22, fontWeight: '700'},
|
|
36
|
+
action_s_bold: {fontSize: 14, lineHeight: 20, fontWeight: '700'},
|
|
37
|
+
action_xs_bold: {fontSize: 12, lineHeight: 16, fontWeight: '700'},
|
|
38
|
+
action_xxs_bold: {fontSize: 10, lineHeight: 14, fontWeight: '700'},
|
|
39
|
+
/**non-support**/
|
|
2
40
|
headline_default: {
|
|
3
41
|
fontSize: 28,
|
|
4
42
|
lineHeight: 34,
|
package/Text/types.ts
CHANGED
|
@@ -14,27 +14,21 @@ export type TypographyWeight = {
|
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
export type Typography =
|
|
17
|
-
| '
|
|
18
|
-
| '
|
|
19
|
-
| '
|
|
20
|
-
| '
|
|
21
|
-
| '
|
|
22
|
-
| '
|
|
23
|
-
| '
|
|
24
|
-
| '
|
|
25
|
-
| '
|
|
26
|
-
| '
|
|
27
|
-
| '
|
|
28
|
-
| '
|
|
29
|
-
| '
|
|
30
|
-
| '
|
|
31
|
-
| '
|
|
32
|
-
| '
|
|
33
|
-
| '
|
|
34
|
-
| '
|
|
35
|
-
| 'label_xs'
|
|
36
|
-
| 'label_s'
|
|
37
|
-
| 'action_default'
|
|
38
|
-
| 'action_xxs'
|
|
39
|
-
| 'action_xs'
|
|
40
|
-
| 'action_s';
|
|
17
|
+
| 'headline_default_bold'
|
|
18
|
+
| 'header_m_bold'
|
|
19
|
+
| 'header_default_bold'
|
|
20
|
+
| 'header_s_semibold'
|
|
21
|
+
| 'header_xs_semibold'
|
|
22
|
+
| 'body_default_regular'
|
|
23
|
+
| 'body_default_regularstrikethrought'
|
|
24
|
+
| 'description_default_regular'
|
|
25
|
+
| 'description_default_regularstrikethrought'
|
|
26
|
+
| 'description_xs_regular'
|
|
27
|
+
| 'description_xs_regularstrikethrought'
|
|
28
|
+
| 'label_default_medium'
|
|
29
|
+
| 'label_s_medium'
|
|
30
|
+
| 'label_xs_medium'
|
|
31
|
+
| 'action_default_bold'
|
|
32
|
+
| 'action_s_bold'
|
|
33
|
+
| 'action_xs_bold'
|
|
34
|
+
| 'action_xxs_bold';
|
package/package.json
CHANGED
package/verify.js
CHANGED
|
@@ -27,8 +27,9 @@ try {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
if (
|
|
30
|
-
miniInfo?.
|
|
31
|
-
miniInfo?.
|
|
30
|
+
miniInfo?.dependencies?.['@momo-platform/momo-core'] &&
|
|
31
|
+
miniInfo?.dependencies?.['@momo-platform/momo-core'] !==
|
|
32
|
+
packageInfo?.version
|
|
32
33
|
) {
|
|
33
34
|
console.error(
|
|
34
35
|
`Package ${packageInfo.name} version: ${packageInfo.version} require install resolutions @momo-platform/momo-core ${packageInfo.version}`,
|