@momo-kits/tab-view 0.92.16-beta.0 → 0.92.16-beta.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/index.tsx +5 -1
- package/package.json +1 -1
- package/publish.sh +13 -6
- package/tabBar/CardTabBar.tsx +2 -4
- package/tabItem/TabItem.tsx +17 -25
- package/types.ts +2 -2
package/index.tsx
CHANGED
|
@@ -29,8 +29,12 @@ const TabView: FC<TabViewProps> = ({
|
|
|
29
29
|
const lazy = useRef([selectedIndex]).current;
|
|
30
30
|
const {theme} = useContext(ApplicationContext);
|
|
31
31
|
const _onPressTabItem = (index: number) => {
|
|
32
|
-
pagerRef.current?.setPage(index);
|
|
33
32
|
onPressTabItem?.(index);
|
|
33
|
+
pagerRef.current?.setPage(index);
|
|
34
|
+
|
|
35
|
+
if (!lazy.includes(index)) {
|
|
36
|
+
lazy.push(index);
|
|
37
|
+
}
|
|
34
38
|
setSelectedIndex(index);
|
|
35
39
|
};
|
|
36
40
|
|
package/package.json
CHANGED
package/publish.sh
CHANGED
|
@@ -6,16 +6,23 @@ mkdir dist
|
|
|
6
6
|
rsync -r --exclude=/dist ./* dist
|
|
7
7
|
cd dist
|
|
8
8
|
|
|
9
|
-
if [ "$1" == "
|
|
10
|
-
npm version $(npm view @momo-kits/tab-view@
|
|
11
|
-
npm version prepatch --preid=beta
|
|
12
|
-
npm publish --tag beta --access=public
|
|
13
|
-
else # Publish latest
|
|
14
|
-
npm version $(npm view @momo-kits/tab-view version)
|
|
9
|
+
if [ "$1" == "stable" ]; then
|
|
10
|
+
npm version $(npm view @momo-kits/tab-view@stable version)
|
|
15
11
|
npm version patch
|
|
12
|
+
npm publish --tag stable --access=public
|
|
13
|
+
elif [ "$1" == "latest" ]; then
|
|
14
|
+
npm version $(npm view @momo-kits/tab-view@latest version)
|
|
15
|
+
npm version prerelease --preid=rc
|
|
16
16
|
npm publish --tag latest --access=public
|
|
17
|
+
else
|
|
18
|
+
npm version $(npm view @momo-kits/tab-view@beta version)
|
|
19
|
+
npm version prerelease --preid=beta
|
|
20
|
+
npm publish --tag beta --access=public
|
|
17
21
|
fi
|
|
18
22
|
|
|
23
|
+
PACKAGE_NAME=$(npm pkg get name)
|
|
24
|
+
NEW_PACKAGE_VERSION=$(npm pkg get version)
|
|
25
|
+
|
|
19
26
|
# Clean up
|
|
20
27
|
cd ..
|
|
21
28
|
rm -rf dist
|
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
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import React, {FC
|
|
1
|
+
import React, {FC} from 'react';
|
|
2
2
|
import {TouchableOpacity, View} from 'react-native';
|
|
3
3
|
import {TabItemProps} from '../types';
|
|
4
4
|
import {
|
|
5
|
-
ApplicationContext,
|
|
6
5
|
Badge,
|
|
7
6
|
BadgeDot,
|
|
8
7
|
Icon,
|
|
@@ -22,7 +21,6 @@ const TabItem: FC<TabItemProps> = ({
|
|
|
22
21
|
selectedColor,
|
|
23
22
|
unselectedColor,
|
|
24
23
|
}) => {
|
|
25
|
-
const {theme} = useContext(ApplicationContext);
|
|
26
24
|
const {
|
|
27
25
|
title,
|
|
28
26
|
icon,
|
|
@@ -52,17 +50,12 @@ const TabItem: FC<TabItemProps> = ({
|
|
|
52
50
|
},
|
|
53
51
|
]}
|
|
54
52
|
onPress={onPressTabItem}>
|
|
55
|
-
{renderIcon &&
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
{marginRight: Spacing.S},
|
|
62
|
-
]}>
|
|
63
|
-
{renderIcon}
|
|
64
|
-
</View>
|
|
65
|
-
)}
|
|
53
|
+
{renderIcon && typeof renderIcon === 'function' && (
|
|
54
|
+
<View
|
|
55
|
+
style={[styles.icon, styles.iconHolder, {marginRight: Spacing.S}]}>
|
|
56
|
+
{renderIcon(active)}
|
|
57
|
+
</View>
|
|
58
|
+
)}
|
|
66
59
|
{!renderIcon && !!icon && (
|
|
67
60
|
<Icon
|
|
68
61
|
style={[styles.icon, {marginRight: Spacing.S}]}
|
|
@@ -105,17 +98,16 @@ const TabItem: FC<TabItemProps> = ({
|
|
|
105
98
|
]}
|
|
106
99
|
onPress={onPressTabItem}>
|
|
107
100
|
<View>
|
|
108
|
-
{renderIcon &&
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
)}
|
|
101
|
+
{renderIcon && typeof renderIcon === 'function' && (
|
|
102
|
+
<View
|
|
103
|
+
style={[
|
|
104
|
+
styles.icon,
|
|
105
|
+
styles.iconHolder,
|
|
106
|
+
{marginBottom: Spacing.XS},
|
|
107
|
+
]}>
|
|
108
|
+
{renderIcon(active)}
|
|
109
|
+
</View>
|
|
110
|
+
)}
|
|
119
111
|
{!renderIcon && !!icon && (
|
|
120
112
|
<Icon
|
|
121
113
|
style={[
|
package/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {ReactElement
|
|
1
|
+
import {ReactElement} from 'react';
|
|
2
2
|
import {PagerViewProps} from 'react-native-pager-view';
|
|
3
3
|
import {Animated} from 'react-native';
|
|
4
4
|
|
|
@@ -13,7 +13,7 @@ export type Tab = {
|
|
|
13
13
|
*/
|
|
14
14
|
icon?: string;
|
|
15
15
|
|
|
16
|
-
renderIcon?:
|
|
16
|
+
renderIcon?: (active: boolean) => ReactElement;
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* The main component or content to be displayed when this tab is active.
|