@momo-kits/tab-view 0.150.2-beta.37 → 0.150.2-beta.40

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/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
- "name": "@momo-kits/tab-view",
3
- "version": "0.150.2-beta.37",
4
- "private": false,
5
- "main": "index.tsx",
6
- "peerDependencies": {
7
- "@momo-kits/foundation": "latest",
8
- "react": "*",
9
- "react-native": "*"
10
- },
11
- "devDependencies": {
12
- "@momo-platform/versions": "4.1.11"
13
- },
14
- "license": "MoMo",
15
- "publishConfig": {
16
- "registry": "https://registry.npmjs.org/"
17
- },
18
- "dependencies": {}
19
- }
2
+ "name": "@momo-kits/tab-view",
3
+ "version": "0.150.2-beta.40",
4
+ "private": false,
5
+ "main": "index.tsx",
6
+ "peerDependencies": {
7
+ "@momo-kits/foundation": "latest",
8
+ "react": "*",
9
+ "react-native": "*"
10
+ },
11
+ "devDependencies": {
12
+ "@momo-platform/versions": "4.1.11"
13
+ },
14
+ "license": "MoMo",
15
+ "publishConfig": {
16
+ "registry": "https://registry.npmjs.org/"
17
+ },
18
+ "dependencies": {}
19
+ }
@@ -1,6 +1,6 @@
1
- import React, {FC, useContext} from 'react';
2
- import {Platform, View} from 'react-native';
3
- import {TabBarProps} from '../types';
1
+ import React, { FC, useContext } from 'react';
2
+ import { Platform, View, Text } from 'react-native';
3
+ import { TabBarProps } from '../types';
4
4
  import styles from '../styles';
5
5
  import {
6
6
  ApplicationContext,
@@ -10,7 +10,6 @@ import {
10
10
  Radius,
11
11
  Shadow,
12
12
  Spacing,
13
- Text,
14
13
  } from '@momo-kits/foundation';
15
14
  import CardTabItem from '../tabItem/CardTabItem';
16
15
  import PathSvg from '../assets/Path';
@@ -24,7 +23,7 @@ const CardTabBar: FC<TabBarProps> = ({
24
23
  unselectedColor,
25
24
  accessibilityLabelForSelectedCard,
26
25
  }) => {
27
- const {theme} = useContext(ApplicationContext);
26
+ const { theme } = useContext(ApplicationContext);
28
27
  const itemWidth = containerWidth / tabs.length;
29
28
  const isFirst = selectedIndex === 0;
30
29
  const isLast = selectedIndex === tabs.length - 1;
@@ -40,8 +39,9 @@ const CardTabBar: FC<TabBarProps> = ({
40
39
  style={[
41
40
  styles.icon,
42
41
  styles.iconHolder,
43
- {marginRight: Spacing.XS},
44
- ]}>
42
+ { marginRight: Spacing.XS },
43
+ ]}
44
+ >
45
45
  {tabs[selectedIndex]?.renderIcon?.(true)}
46
46
  </View>
47
47
  )}
@@ -49,7 +49,7 @@ const CardTabBar: FC<TabBarProps> = ({
49
49
  <Icon
50
50
  color={selectedColor}
51
51
  source={tabs[selectedIndex]?.icon as string}
52
- style={[styles.icon, {marginRight: Spacing.XS}]}
52
+ style={[styles.icon, { marginRight: Spacing.XS }]}
53
53
  />
54
54
  )}
55
55
  </>
@@ -81,10 +81,11 @@ const CardTabBar: FC<TabBarProps> = ({
81
81
  width: containerWidth / tabs.length,
82
82
  left: itemWidth * selectedIndex - backSpace,
83
83
  },
84
- ]}>
84
+ ]}
85
+ >
85
86
  {!isFirst && (
86
87
  <PathSvg
87
- style={{transform: [{rotateY: '180deg'}], left: 8}}
88
+ style={{ transform: [{ rotateY: '180deg' }], left: 8 }}
88
89
  pathWidth={pathWidth}
89
90
  />
90
91
  )}
@@ -102,13 +103,22 @@ const CardTabBar: FC<TabBarProps> = ({
102
103
  borderTopLeftRadius: Radius.M,
103
104
  paddingHorizontal: tabs.length === 3 ? Spacing.S : Spacing.M,
104
105
  },
105
- ]}>
106
+ ]}
107
+ >
106
108
  {renderIconTabBar()}
107
109
  <Text
108
- color={selectedColor}
109
110
  numberOfLines={1}
110
- style={[styles.textCenter, {flexShrink: 1}]}
111
- typography={'header_s_semibold'}>
111
+ style={[
112
+ styles.textCenter,
113
+ {
114
+ flexShrink: 1,
115
+ color: selectedColor,
116
+ fontSize: 14,
117
+ lineHeight: 20,
118
+ fontWeight: '600',
119
+ },
120
+ ]}
121
+ >
112
122
  {tabs[selectedIndex]?.title || ''}
113
123
  </Text>
114
124
  {tabs[selectedIndex]?.showDot && (
@@ -123,12 +133,12 @@ const CardTabBar: FC<TabBarProps> = ({
123
133
  <View>
124
134
  <Badge
125
135
  label={tabs[selectedIndex]?.badgeValue}
126
- style={{marginLeft: Spacing.XS}}
136
+ style={{ marginLeft: Spacing.XS }}
127
137
  />
128
138
  </View>
129
139
  )}
130
140
  </View>
131
- {!isLast && <PathSvg style={{right: 8}} pathWidth={pathWidth} />}
141
+ {!isLast && <PathSvg style={{ right: 8 }} pathWidth={pathWidth} />}
132
142
  </View>
133
143
  </View>
134
144
  );
@@ -1,6 +1,6 @@
1
- import React, {FC, useContext, useMemo} from 'react';
2
- import {TouchableOpacity, View} from 'react-native';
3
- import {TabItemProps} from '../types';
1
+ import React, { FC, useContext, useMemo } from 'react';
2
+ import { TouchableOpacity, View, Text } from 'react-native';
3
+ import { TabItemProps } from '../types';
4
4
  import styles from '../styles';
5
5
  import {
6
6
  Badge,
@@ -9,7 +9,6 @@ import {
9
9
  MiniAppContext,
10
10
  ScreenContext,
11
11
  Spacing,
12
- Text,
13
12
  } from '@momo-kits/foundation';
14
13
 
15
14
  const CardTabItem: FC<TabItemProps> = ({
@@ -49,14 +48,19 @@ const CardTabItem: FC<TabItemProps> = ({
49
48
  <>
50
49
  {typeof renderIcon === 'function' && (
51
50
  <View
52
- style={[styles.icon, styles.iconHolder, {marginRight: Spacing.XS}]}>
51
+ style={[
52
+ styles.icon,
53
+ styles.iconHolder,
54
+ { marginRight: Spacing.XS },
55
+ ]}
56
+ >
53
57
  {renderIcon(active)}
54
58
  </View>
55
59
  )}
56
60
  {!renderIcon && !!icon && (
57
61
  <Icon
58
62
  color={color}
59
- style={[styles.icon, {marginRight: Spacing.XS}]}
63
+ style={[styles.icon, { marginRight: Spacing.XS }]}
60
64
  source={icon}
61
65
  />
62
66
  )}
@@ -67,15 +71,19 @@ const CardTabItem: FC<TabItemProps> = ({
67
71
  return (
68
72
  <TouchableOpacity
69
73
  onPress={onPressTabItem}
70
- style={[styles.cardTabItem, {width}]}
74
+ style={[styles.cardTabItem, { width }]}
71
75
  accessibilityLabel={componentId}
72
- accessibilityState={{checked: active}}>
76
+ accessibilityState={{ checked: active }}
77
+ >
73
78
  {renderIconTabItem()}
74
79
  <Text
75
80
  numberOfLines={1}
76
- style={[styles.textCenter, {flexShrink: 1}]}
77
- typography={'body_default_regular'}
78
- accessibilityLabel={`${componentId}|text`}>
81
+ style={[
82
+ styles.textCenter,
83
+ { flexShrink: 1, fontSize: 14, lineHeight: 20 },
84
+ ]}
85
+ accessibilityLabel={`${componentId}|text`}
86
+ >
79
87
  {title}
80
88
  </Text>
81
89
  {showDot && (
@@ -90,7 +98,7 @@ const CardTabItem: FC<TabItemProps> = ({
90
98
  <View>
91
99
  <Badge
92
100
  label={badgeValue}
93
- style={{marginLeft: Spacing.XS}}
101
+ style={{ marginLeft: Spacing.XS }}
94
102
  accessibilityLabel={`${componentId}|badge`}
95
103
  />
96
104
  </View>
@@ -1,16 +1,14 @@
1
1
  import React, { FC, useContext, useMemo } from 'react';
2
- import { TouchableOpacity, View } from 'react-native';
2
+ import { Text, TouchableOpacity, View } from 'react-native';
3
3
  import { TabItemProps } from '../types';
4
4
  import {
5
5
  Badge,
6
6
  BadgeDot,
7
+ exportFontFamily,
7
8
  Icon,
8
9
  MiniAppContext,
9
- scaleSize,
10
10
  ScreenContext,
11
11
  Spacing,
12
- Text,
13
- Typography,
14
12
  } from '@momo-kits/foundation';
15
13
  import styles from '../styles';
16
14
 
@@ -32,9 +30,6 @@ const TabItem: FC<TabItemProps> = ({
32
30
  renderIcon,
33
31
  accessibilityLabel,
34
32
  } = tab;
35
- const typography: Typography = active
36
- ? 'header_s_semibold'
37
- : 'body_default_regular';
38
33
  const color = active ? selectedColor : unselectedColor;
39
34
  const dotStyle = dotSize === 'large' ? styles.dot : styles.dotSmall;
40
35
  const app = useContext<any>(MiniAppContext);
@@ -54,48 +49,55 @@ const TabItem: FC<TabItemProps> = ({
54
49
  return (
55
50
  <TouchableOpacity
56
51
  accessibilityLabel={componentId}
57
- accessibilityState={{checked: active}}
52
+ accessibilityState={{ checked: active }}
58
53
  style={[
59
54
  styles.tabItem,
60
55
  {
61
56
  width,
62
- height: scaleSize(48),
57
+ height: 48,
63
58
  flexDirection: 'row',
64
59
  overflow: 'hidden',
65
60
  paddingVertical: Spacing.M,
66
61
  paddingHorizontal: Spacing.M,
67
62
  },
68
63
  ]}
69
- onPress={onPressTabItem}>
64
+ onPress={onPressTabItem}
65
+ >
70
66
  {renderIcon && typeof renderIcon === 'function' && (
71
67
  <View
72
- style={[styles.icon, styles.iconHolder, {marginRight: Spacing.S}]}>
68
+ style={[styles.icon, styles.iconHolder, { marginRight: Spacing.S }]}
69
+ >
73
70
  {renderIcon(active)}
74
71
  </View>
75
72
  )}
76
73
  {!renderIcon && !!icon && (
77
74
  <Icon
78
- style={[styles.icon, {marginRight: Spacing.S}]}
75
+ style={[styles.icon, { marginRight: Spacing.S }]}
79
76
  source={icon}
80
77
  color={color}
81
78
  />
82
79
  )}
83
80
  <Text
84
81
  numberOfLines={1}
85
- typography={typography}
86
- color={color}
87
- style={{flexShrink: 1}}
88
- accessibilityLabel={`${componentId}|text`}>
82
+ style={{
83
+ flexShrink: 1,
84
+ fontSize: 14,
85
+ lineHeight: 20,
86
+ fontWeight: active ? '600' : '400',
87
+ color,
88
+ }}
89
+ accessibilityLabel={`${componentId}|text`}
90
+ >
89
91
  {title}
90
92
  </Text>
91
93
  {showDot && (
92
- <BadgeDot size={dotSize} style={{marginLeft: Spacing.XS}} />
94
+ <BadgeDot size={dotSize} style={{ marginLeft: Spacing.XS }} />
93
95
  )}
94
96
  {!showDot && badgeValue && (
95
97
  <View>
96
98
  <Badge
97
99
  label={badgeValue}
98
- style={{marginLeft: Spacing.XS}}
100
+ style={{ marginLeft: Spacing.XS }}
99
101
  accessibilityLabel={`${componentId}|badge`}
100
102
  />
101
103
  </View>
@@ -111,7 +113,7 @@ const TabItem: FC<TabItemProps> = ({
111
113
  styles.tabItem,
112
114
  {
113
115
  width,
114
- height: scaleSize(68),
116
+ height: 68,
115
117
  flexDirection: 'column',
116
118
  overflow: 'hidden',
117
119
  paddingHorizontal: Spacing.M,
@@ -120,15 +122,17 @@ const TabItem: FC<TabItemProps> = ({
120
122
  ]}
121
123
  onPress={onPressTabItem}
122
124
  accessibilityLabel={componentId}
123
- accessibilityState={{checked: active}}>
125
+ accessibilityState={{ checked: active }}
126
+ >
124
127
  <View>
125
128
  {renderIcon && typeof renderIcon === 'function' && (
126
129
  <View
127
130
  style={[
128
131
  styles.icon,
129
132
  styles.iconHolder,
130
- {marginBottom: Spacing.XS},
131
- ]}>
133
+ { marginBottom: Spacing.XS },
134
+ ]}
135
+ >
132
136
  {renderIcon(active)}
133
137
  </View>
134
138
  )}
@@ -157,9 +161,15 @@ const TabItem: FC<TabItemProps> = ({
157
161
  </View>
158
162
  <Text
159
163
  numberOfLines={1}
160
- typography={typography}
161
- color={color}
162
- accessibilityLabel={`${componentId}|text`}>
164
+ style={{
165
+ flexShrink: 1,
166
+ fontSize: 14,
167
+ lineHeight: 20,
168
+ color,
169
+ fontWeight: active ? '600' : '400',
170
+ }}
171
+ accessibilityLabel={`${componentId}|text`}
172
+ >
163
173
  {title}
164
174
  </Text>
165
175
  </TouchableOpacity>