@momo-kits/tab-view 0.105.1-beta.2 → 0.105.1-beta.3
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/index.tsx +0 -2
- package/package.json +1 -1
- package/tabBar/CardTabBar.tsx +21 -27
- package/tabItem/CardTabItem.tsx +17 -24
- package/types.ts +0 -15
package/index.tsx
CHANGED
|
@@ -38,7 +38,6 @@ const TabComponent: ForwardRefRenderFunction<TabViewRef, TabViewProps> = (
|
|
|
38
38
|
style,
|
|
39
39
|
accessibilityLabel,
|
|
40
40
|
accessibilityLabelForSelectedCard,
|
|
41
|
-
useIcon = true,
|
|
42
41
|
},
|
|
43
42
|
ref
|
|
44
43
|
) => {
|
|
@@ -128,7 +127,6 @@ const TabComponent: ForwardRefRenderFunction<TabViewRef, TabViewProps> = (
|
|
|
128
127
|
selectedColor={selectedColor ?? theme.colors.primary}
|
|
129
128
|
unselectedColor={unselectedColor ?? theme.colors.text.default}
|
|
130
129
|
accessibilityLabelForSelectedCard={accessibilityLabelForSelectedCard}
|
|
131
|
-
useIcon={isCardTab ? useIcon : true}
|
|
132
130
|
/>
|
|
133
131
|
</Animated.View>
|
|
134
132
|
|
package/package.json
CHANGED
package/tabBar/CardTabBar.tsx
CHANGED
|
@@ -23,7 +23,6 @@ const CardTabBar: FC<TabBarProps> = ({
|
|
|
23
23
|
selectedColor,
|
|
24
24
|
unselectedColor,
|
|
25
25
|
accessibilityLabelForSelectedCard,
|
|
26
|
-
useIcon = true,
|
|
27
26
|
}) => {
|
|
28
27
|
const {theme} = useContext(ApplicationContext);
|
|
29
28
|
const itemWidth = containerWidth / tabs.length;
|
|
@@ -32,33 +31,29 @@ const CardTabBar: FC<TabBarProps> = ({
|
|
|
32
31
|
const backSpace = isFirst ? 0 : 28;
|
|
33
32
|
const pathWidth = tabs.length > 2 ? 22 : 28;
|
|
34
33
|
|
|
35
|
-
console.log('useIcon', useIcon);
|
|
36
|
-
|
|
37
34
|
const renderIconTabBar = () => {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
</View>
|
|
51
|
-
)}
|
|
52
|
-
{!tabs[selectedIndex]?.renderIcon && !!tabs[selectedIndex]?.icon && (
|
|
53
|
-
<Icon
|
|
54
|
-
color={selectedColor}
|
|
55
|
-
source={tabs[selectedIndex]?.icon as string}
|
|
56
|
-
style={[styles.icon, {marginRight: Spacing.XS}]}
|
|
57
|
-
/>
|
|
35
|
+
return (
|
|
36
|
+
<>
|
|
37
|
+
{!!tabs[selectedIndex]?.renderIcon &&
|
|
38
|
+
typeof tabs[selectedIndex]?.renderIcon === 'function' && (
|
|
39
|
+
<View
|
|
40
|
+
style={[
|
|
41
|
+
styles.icon,
|
|
42
|
+
styles.iconHolder,
|
|
43
|
+
{marginRight: Spacing.XS},
|
|
44
|
+
]}>
|
|
45
|
+
{tabs[selectedIndex]?.renderIcon?.(true)}
|
|
46
|
+
</View>
|
|
58
47
|
)}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
48
|
+
{!tabs[selectedIndex]?.renderIcon && !!tabs[selectedIndex]?.icon && (
|
|
49
|
+
<Icon
|
|
50
|
+
color={selectedColor}
|
|
51
|
+
source={tabs[selectedIndex]?.icon as string}
|
|
52
|
+
style={[styles.icon, {marginRight: Spacing.XS}]}
|
|
53
|
+
/>
|
|
54
|
+
)}
|
|
55
|
+
</>
|
|
56
|
+
);
|
|
62
57
|
};
|
|
63
58
|
|
|
64
59
|
return (
|
|
@@ -74,7 +69,6 @@ const CardTabBar: FC<TabBarProps> = ({
|
|
|
74
69
|
width={itemWidth}
|
|
75
70
|
selectedColor={selectedColor}
|
|
76
71
|
unselectedColor={unselectedColor}
|
|
77
|
-
useIcon={useIcon}
|
|
78
72
|
/>
|
|
79
73
|
);
|
|
80
74
|
})}
|
package/tabItem/CardTabItem.tsx
CHANGED
|
@@ -19,7 +19,6 @@ const CardTabItem: FC<TabItemProps> = ({
|
|
|
19
19
|
width,
|
|
20
20
|
selectedColor,
|
|
21
21
|
unselectedColor,
|
|
22
|
-
useIcon,
|
|
23
22
|
}) => {
|
|
24
23
|
const {
|
|
25
24
|
title,
|
|
@@ -46,29 +45,23 @@ const CardTabItem: FC<TabItemProps> = ({
|
|
|
46
45
|
}, [componentName, accessibilityLabel, app, screen]);
|
|
47
46
|
|
|
48
47
|
const renderIconTabItem = () => {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
source={icon}
|
|
67
|
-
/>
|
|
68
|
-
)}
|
|
69
|
-
</>
|
|
70
|
-
);
|
|
71
|
-
}
|
|
48
|
+
return (
|
|
49
|
+
<>
|
|
50
|
+
{typeof renderIcon === 'function' && (
|
|
51
|
+
<View
|
|
52
|
+
style={[styles.icon, styles.iconHolder, {marginRight: Spacing.XS}]}>
|
|
53
|
+
{renderIcon(active)}
|
|
54
|
+
</View>
|
|
55
|
+
)}
|
|
56
|
+
{!renderIcon && !!icon && (
|
|
57
|
+
<Icon
|
|
58
|
+
color={color}
|
|
59
|
+
style={[styles.icon, {marginRight: Spacing.XS}]}
|
|
60
|
+
source={icon}
|
|
61
|
+
/>
|
|
62
|
+
)}
|
|
63
|
+
</>
|
|
64
|
+
);
|
|
72
65
|
};
|
|
73
66
|
|
|
74
67
|
return (
|
package/types.ts
CHANGED
|
@@ -64,11 +64,6 @@ export type TabItemProps = {
|
|
|
64
64
|
selectedColor?: string;
|
|
65
65
|
|
|
66
66
|
unselectedColor?: string;
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Optional. If `false`, all tabs's icon will not be displayed.
|
|
70
|
-
*/
|
|
71
|
-
useIcon?: boolean;
|
|
72
67
|
};
|
|
73
68
|
|
|
74
69
|
export type TabViewProps = {
|
|
@@ -116,11 +111,6 @@ export type TabViewProps = {
|
|
|
116
111
|
accessibilityLabel?: string;
|
|
117
112
|
|
|
118
113
|
accessibilityLabelForSelectedCard?: string;
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Optional. If `false`, all tabs's icon will not be displayed.
|
|
122
|
-
*/
|
|
123
|
-
useIcon?: boolean;
|
|
124
114
|
};
|
|
125
115
|
|
|
126
116
|
/**
|
|
@@ -162,11 +152,6 @@ export type TabBarProps = {
|
|
|
162
152
|
unselectedColor?: string;
|
|
163
153
|
|
|
164
154
|
accessibilityLabelForSelectedCard?: string;
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Optional. If `false`, all tabs's icon will not be displayed.
|
|
168
|
-
*/
|
|
169
|
-
useIcon?: boolean;
|
|
170
155
|
};
|
|
171
156
|
|
|
172
157
|
export type TabViewRef = {
|