@momo-kits/tab-view 0.92.8-beta.10 → 0.92.8-beta.15
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 +5 -0
- package/package.json +15 -15
- package/tabBar/CardTabBar.tsx +2 -4
- package/tabItem/TabItem.tsx +16 -22
- package/types.ts +1 -1
package/index.tsx
CHANGED
|
@@ -30,6 +30,11 @@ const TabView: FC<TabViewProps> = ({
|
|
|
30
30
|
const {theme} = useContext(ApplicationContext);
|
|
31
31
|
const _onPressTabItem = (index: number) => {
|
|
32
32
|
pagerRef.current?.setPage(index);
|
|
33
|
+
|
|
34
|
+
if (!lazy.includes(index)) {
|
|
35
|
+
lazy.push(index);
|
|
36
|
+
}
|
|
37
|
+
|
|
33
38
|
onPressTabItem?.(index);
|
|
34
39
|
setSelectedIndex(index);
|
|
35
40
|
};
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
"name": "@momo-kits/tab-view",
|
|
3
|
+
"version": "0.92.8-beta.15",
|
|
4
|
+
"private": false,
|
|
5
|
+
"main": "index.tsx",
|
|
6
|
+
"dependencies": {},
|
|
7
|
+
"peerDependencies": {
|
|
8
|
+
"@momo-kits/foundation": "latest",
|
|
9
|
+
"prop-types": "^15.7.2",
|
|
10
|
+
"react": "16.9.0",
|
|
11
|
+
"react-native": ">=0.55"
|
|
12
|
+
},
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@momo-platform/versions": "4.1.11"
|
|
15
|
+
},
|
|
16
|
+
"license": "MoMo"
|
|
17
17
|
}
|
package/tabBar/CardTabBar.tsx
CHANGED
|
@@ -69,16 +69,14 @@ const CardTabBar: FC<TabBarProps> = ({
|
|
|
69
69
|
},
|
|
70
70
|
]}>
|
|
71
71
|
{!!tabs[selectedIndex]?.renderIcon &&
|
|
72
|
-
|
|
73
|
-
typeof tabs[selectedIndex]?.renderIcon,
|
|
74
|
-
) && (
|
|
72
|
+
typeof tabs[selectedIndex]?.renderIcon === 'function' && (
|
|
75
73
|
<View
|
|
76
74
|
style={[
|
|
77
75
|
styles.icon,
|
|
78
76
|
styles.iconHolder,
|
|
79
77
|
{marginRight: Spacing.XS},
|
|
80
78
|
]}>
|
|
81
|
-
{tabs[selectedIndex]?.renderIcon}
|
|
79
|
+
{tabs[selectedIndex]?.renderIcon?.(true)}
|
|
82
80
|
</View>
|
|
83
81
|
)}
|
|
84
82
|
{!tabs[selectedIndex]?.renderIcon && !!tabs[selectedIndex]?.icon && (
|
package/tabItem/TabItem.tsx
CHANGED
|
@@ -52,17 +52,12 @@ const TabItem: FC<TabItemProps> = ({
|
|
|
52
52
|
},
|
|
53
53
|
]}
|
|
54
54
|
onPress={onPressTabItem}>
|
|
55
|
-
{renderIcon &&
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
{marginRight: Spacing.S},
|
|
62
|
-
]}>
|
|
63
|
-
{renderIcon}
|
|
64
|
-
</View>
|
|
65
|
-
)}
|
|
55
|
+
{renderIcon && typeof renderIcon === 'function' && (
|
|
56
|
+
<View
|
|
57
|
+
style={[styles.icon, styles.iconHolder, {marginRight: Spacing.S}]}>
|
|
58
|
+
{renderIcon(active)}
|
|
59
|
+
</View>
|
|
60
|
+
)}
|
|
66
61
|
{!renderIcon && !!icon && (
|
|
67
62
|
<Icon
|
|
68
63
|
style={[styles.icon, {marginRight: Spacing.S}]}
|
|
@@ -105,17 +100,16 @@ const TabItem: FC<TabItemProps> = ({
|
|
|
105
100
|
]}
|
|
106
101
|
onPress={onPressTabItem}>
|
|
107
102
|
<View>
|
|
108
|
-
{renderIcon &&
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
)}
|
|
103
|
+
{renderIcon && typeof renderIcon === 'function' && (
|
|
104
|
+
<View
|
|
105
|
+
style={[
|
|
106
|
+
styles.icon,
|
|
107
|
+
styles.iconHolder,
|
|
108
|
+
{marginBottom: Spacing.XS},
|
|
109
|
+
]}>
|
|
110
|
+
{renderIcon(active)}
|
|
111
|
+
</View>
|
|
112
|
+
)}
|
|
119
113
|
{!renderIcon && !!icon && (
|
|
120
114
|
<Icon
|
|
121
115
|
style={[
|