@momo-kits/tab-view 0.102.4 → 0.103.1-beta.1
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 +9 -4
- package/package.json +15 -15
- package/publish.sh +5 -5
package/index.tsx
CHANGED
|
@@ -13,7 +13,10 @@ import TabBar from './tabBar/TabBar';
|
|
|
13
13
|
import styles from './styles';
|
|
14
14
|
import CardTabBar from './tabBar/CardTabBar';
|
|
15
15
|
import ScrollableTabBar from './tabBar/SrollableTabBar';
|
|
16
|
-
import PagerView
|
|
16
|
+
import PagerView, {
|
|
17
|
+
PagerViewOnPageScrollEvent,
|
|
18
|
+
PagerViewOnPageSelectedEvent,
|
|
19
|
+
} from 'react-native-pager-view';
|
|
17
20
|
import {ApplicationContext} from '@momo-kits/foundation';
|
|
18
21
|
|
|
19
22
|
const TabComponent: ForwardRefRenderFunction<TabViewRef, TabViewProps> = (
|
|
@@ -53,12 +56,13 @@ const TabComponent: ForwardRefRenderFunction<TabViewRef, TabViewProps> = (
|
|
|
53
56
|
setTabBarWidth(e.nativeEvent.layout.width);
|
|
54
57
|
};
|
|
55
58
|
|
|
56
|
-
const onPageSelected = (e:
|
|
59
|
+
const onPageSelected = (e: PagerViewOnPageSelectedEvent) => {
|
|
57
60
|
const {position} = e.nativeEvent;
|
|
58
61
|
if (!lazy.includes(position)) {
|
|
59
62
|
lazy.push(position);
|
|
60
63
|
}
|
|
61
64
|
setSelectedIndex(position);
|
|
65
|
+
pagerProps?.onPageSelected?.(e);
|
|
62
66
|
};
|
|
63
67
|
|
|
64
68
|
let TabBarComponent = scrollable ? ScrollableTabBar : TabBar;
|
|
@@ -67,9 +71,10 @@ const TabComponent: ForwardRefRenderFunction<TabViewRef, TabViewProps> = (
|
|
|
67
71
|
TabBarComponent = CardTabBar;
|
|
68
72
|
}
|
|
69
73
|
|
|
70
|
-
const onPageScroll = (e:
|
|
74
|
+
const onPageScroll = (e: PagerViewOnPageScrollEvent) => {
|
|
71
75
|
const {position, offset} = e.nativeEvent;
|
|
72
76
|
scrollX.current.setValue(position + offset);
|
|
77
|
+
pagerProps?.onPageScroll?.(e);
|
|
73
78
|
};
|
|
74
79
|
|
|
75
80
|
const renderScreen = useCallback(
|
|
@@ -117,4 +122,4 @@ const TabComponent: ForwardRefRenderFunction<TabViewRef, TabViewProps> = (
|
|
|
117
122
|
const TabView = forwardRef(TabComponent);
|
|
118
123
|
|
|
119
124
|
export {CardTabBar, ScrollableTabBar, TabBar, TabView};
|
|
120
|
-
export type {TabViewProps, Tab};
|
|
125
|
+
export type {TabViewProps, TabViewRef, Tab};
|
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.103.1-beta.1",
|
|
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/publish.sh
CHANGED
|
@@ -7,15 +7,15 @@ rsync -r --exclude=/dist ./* dist
|
|
|
7
7
|
cd dist
|
|
8
8
|
|
|
9
9
|
if [ "$1" == "stable" ]; then
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
npm version $(npm view @momo-kits/foundation@stable version)
|
|
11
|
+
npm version patch
|
|
12
12
|
npm publish --tag stable --access=public
|
|
13
13
|
elif [ "$1" == "latest" ]; then
|
|
14
|
-
|
|
14
|
+
npm version $(npm view @momo-kits/foundation@latest version)
|
|
15
15
|
npm publish --tag latest --access=public
|
|
16
16
|
else
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
npm version $(npm view @momo-kits/tab-view@beta version)
|
|
18
|
+
npm version prerelease --preid=beta
|
|
19
19
|
npm publish --tag beta --access=public
|
|
20
20
|
fi
|
|
21
21
|
|