@hero-design/rn 8.3.2 → 8.3.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/.turbo/turbo-build.log +9 -9
- package/es/index.js +14 -4
- package/lib/index.js +14 -4
- package/package.json +5 -5
- package/src/components/Tabs/ScrollableTabs.tsx +14 -3
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
[
|
|
2
|
-
[
|
|
3
|
-
[
|
|
4
|
-
[
|
|
5
|
-
[
|
|
6
|
-
[
|
|
7
|
-
[
|
|
8
|
-
[
|
|
9
|
-
[
|
|
1
|
+
[35m@hero-design/rn:build[0m: cache hit, replaying output [2ma707437faede395b[0m
|
|
2
|
+
[35m@hero-design/rn:build: [0m$ yarn build:js && yarn build:types
|
|
3
|
+
[35m@hero-design/rn:build: [0m$ rollup -c
|
|
4
|
+
[35m@hero-design/rn:build: [0m[36m
|
|
5
|
+
[35m@hero-design/rn:build: [0m[1msrc/index.ts[22m → [1mlib/index.js, es/index.js[22m...[39m
|
|
6
|
+
[35m@hero-design/rn:build: [0m[1m[33m(!) Plugin replace: @rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to `true`, as the next major version will default this option to `true`.[39m[22m
|
|
7
|
+
[35m@hero-design/rn:build: [0m[1m[33m(!) Plugin node-resolve: preferring built-in module 'events' over local alternative at '/root/hero-design/node_modules/events/events.js', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning[39m[22m
|
|
8
|
+
[35m@hero-design/rn:build: [0m[32mcreated [1mlib/index.js, es/index.js[22m in [1m24.4s[22m[39m
|
|
9
|
+
[35m@hero-design/rn:build: [0m$ tsc --noEmit false --emitDeclarationOnly --project tsconfig.prod.json
|
package/es/index.js
CHANGED
|
@@ -13954,13 +13954,20 @@ var ScrollableTab = function ScrollableTab(_ref2) {
|
|
|
13954
13954
|
return i === selectedTabIndex ? 1 : 0;
|
|
13955
13955
|
}));
|
|
13956
13956
|
React.useEffect(function () {
|
|
13957
|
+
var timeoutHandle = null;
|
|
13957
13958
|
if (selectedTabIndex !== -1) {
|
|
13958
|
-
var _flatListRef$current
|
|
13959
|
+
var _flatListRef$current;
|
|
13959
13960
|
(_flatListRef$current = flatListRef.current) === null || _flatListRef$current === void 0 ? void 0 : _flatListRef$current.scrollToIndex({
|
|
13960
13961
|
index: selectedTabIndex,
|
|
13961
13962
|
viewPosition: 0.5
|
|
13962
13963
|
});
|
|
13963
|
-
|
|
13964
|
+
// If the selected tab is changed too quickly, the setPage is crashed and not work anymore
|
|
13965
|
+
// We apply throttle to prevent this issue https://github.com/Thinkei/hero-design/issues/1715
|
|
13966
|
+
timeoutHandle = setTimeout(function () {
|
|
13967
|
+
var _pagerViewRef$current;
|
|
13968
|
+
// use no animation to prevent unexpected behavior if users select tab too quickly
|
|
13969
|
+
(_pagerViewRef$current = pagerViewRef.current) === null || _pagerViewRef$current === void 0 ? void 0 : _pagerViewRef$current.setPageWithoutAnimation(selectedTabIndex);
|
|
13970
|
+
}, 200);
|
|
13964
13971
|
}
|
|
13965
13972
|
var animation = Animated.parallel(_toConsumableArray(tabs.map(function (_, i) {
|
|
13966
13973
|
return Animated.timing(tabsAnims[i], {
|
|
@@ -13971,9 +13978,12 @@ var ScrollableTab = function ScrollableTab(_ref2) {
|
|
|
13971
13978
|
})));
|
|
13972
13979
|
animation.start();
|
|
13973
13980
|
return function () {
|
|
13974
|
-
|
|
13981
|
+
animation.stop();
|
|
13982
|
+
if (timeoutHandle) {
|
|
13983
|
+
clearTimeout(timeoutHandle);
|
|
13984
|
+
}
|
|
13975
13985
|
};
|
|
13976
|
-
}, [selectedTabIndex]);
|
|
13986
|
+
}, [selectedTabIndex, pagerViewRef]);
|
|
13977
13987
|
return /*#__PURE__*/React.createElement(TabContainer, {
|
|
13978
13988
|
style: containerStyle,
|
|
13979
13989
|
testID: componentTestID
|
package/lib/index.js
CHANGED
|
@@ -13983,13 +13983,20 @@ var ScrollableTab = function ScrollableTab(_ref2) {
|
|
|
13983
13983
|
return i === selectedTabIndex ? 1 : 0;
|
|
13984
13984
|
}));
|
|
13985
13985
|
React__default["default"].useEffect(function () {
|
|
13986
|
+
var timeoutHandle = null;
|
|
13986
13987
|
if (selectedTabIndex !== -1) {
|
|
13987
|
-
var _flatListRef$current
|
|
13988
|
+
var _flatListRef$current;
|
|
13988
13989
|
(_flatListRef$current = flatListRef.current) === null || _flatListRef$current === void 0 ? void 0 : _flatListRef$current.scrollToIndex({
|
|
13989
13990
|
index: selectedTabIndex,
|
|
13990
13991
|
viewPosition: 0.5
|
|
13991
13992
|
});
|
|
13992
|
-
|
|
13993
|
+
// If the selected tab is changed too quickly, the setPage is crashed and not work anymore
|
|
13994
|
+
// We apply throttle to prevent this issue https://github.com/Thinkei/hero-design/issues/1715
|
|
13995
|
+
timeoutHandle = setTimeout(function () {
|
|
13996
|
+
var _pagerViewRef$current;
|
|
13997
|
+
// use no animation to prevent unexpected behavior if users select tab too quickly
|
|
13998
|
+
(_pagerViewRef$current = pagerViewRef.current) === null || _pagerViewRef$current === void 0 ? void 0 : _pagerViewRef$current.setPageWithoutAnimation(selectedTabIndex);
|
|
13999
|
+
}, 200);
|
|
13993
14000
|
}
|
|
13994
14001
|
var animation = reactNative.Animated.parallel(_toConsumableArray(tabs.map(function (_, i) {
|
|
13995
14002
|
return reactNative.Animated.timing(tabsAnims[i], {
|
|
@@ -14000,9 +14007,12 @@ var ScrollableTab = function ScrollableTab(_ref2) {
|
|
|
14000
14007
|
})));
|
|
14001
14008
|
animation.start();
|
|
14002
14009
|
return function () {
|
|
14003
|
-
|
|
14010
|
+
animation.stop();
|
|
14011
|
+
if (timeoutHandle) {
|
|
14012
|
+
clearTimeout(timeoutHandle);
|
|
14013
|
+
}
|
|
14004
14014
|
};
|
|
14005
|
-
}, [selectedTabIndex]);
|
|
14015
|
+
}, [selectedTabIndex, pagerViewRef]);
|
|
14006
14016
|
return /*#__PURE__*/React__default["default"].createElement(TabContainer, {
|
|
14007
14017
|
style: containerStyle,
|
|
14008
14018
|
testID: componentTestID
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hero-design/rn",
|
|
3
|
-
"version": "8.3.
|
|
3
|
+
"version": "8.3.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@emotion/native": "^11.9.3",
|
|
23
23
|
"@emotion/react": "^11.9.3",
|
|
24
|
-
"@hero-design/colors": "8.3.
|
|
24
|
+
"@hero-design/colors": "8.3.3",
|
|
25
25
|
"date-fns": "^2.16.1",
|
|
26
26
|
"events": "^3.2.0",
|
|
27
27
|
"hero-editor": "^1.9.21"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@babel/preset-typescript": "^7.17.12",
|
|
45
45
|
"@babel/runtime": "^7.18.9",
|
|
46
46
|
"@emotion/jest": "^11.9.3",
|
|
47
|
-
"@hero-design/eslint-plugin": "8.3.
|
|
47
|
+
"@hero-design/eslint-plugin": "8.3.3",
|
|
48
48
|
"@react-native-community/datetimepicker": "^3.5.2",
|
|
49
49
|
"@react-native-community/slider": "4.1.12",
|
|
50
50
|
"@rollup/plugin-babel": "^5.3.1",
|
|
@@ -60,9 +60,9 @@
|
|
|
60
60
|
"@types/react-native": "^0.67.7",
|
|
61
61
|
"@types/react-native-vector-icons": "^6.4.10",
|
|
62
62
|
"babel-plugin-inline-import": "^3.0.0",
|
|
63
|
-
"eslint-config-hd": "8.3.
|
|
63
|
+
"eslint-config-hd": "8.3.3",
|
|
64
64
|
"jest": "^27.3.1",
|
|
65
|
-
"prettier-config-hd": "8.3.
|
|
65
|
+
"prettier-config-hd": "8.3.3",
|
|
66
66
|
"react": "18.0.0",
|
|
67
67
|
"react-native": "0.69.7",
|
|
68
68
|
"react-native-gesture-handler": "~2.1.0",
|
|
@@ -78,12 +78,18 @@ const ScrollableTab = ({
|
|
|
78
78
|
);
|
|
79
79
|
|
|
80
80
|
React.useEffect(() => {
|
|
81
|
+
let timeoutHandle: number | null = null;
|
|
81
82
|
if (selectedTabIndex !== -1) {
|
|
82
83
|
flatListRef.current?.scrollToIndex({
|
|
83
84
|
index: selectedTabIndex,
|
|
84
85
|
viewPosition: 0.5,
|
|
85
86
|
});
|
|
86
|
-
|
|
87
|
+
// If the selected tab is changed too quickly, the setPage is crashed and not work anymore
|
|
88
|
+
// We apply throttle to prevent this issue https://github.com/Thinkei/hero-design/issues/1715
|
|
89
|
+
timeoutHandle = setTimeout(() => {
|
|
90
|
+
// use no animation to prevent unexpected behavior if users select tab too quickly
|
|
91
|
+
pagerViewRef.current?.setPageWithoutAnimation(selectedTabIndex);
|
|
92
|
+
}, 200);
|
|
87
93
|
}
|
|
88
94
|
|
|
89
95
|
const animation = Animated.parallel([
|
|
@@ -97,8 +103,13 @@ const ScrollableTab = ({
|
|
|
97
103
|
]);
|
|
98
104
|
animation.start();
|
|
99
105
|
|
|
100
|
-
return () =>
|
|
101
|
-
|
|
106
|
+
return () => {
|
|
107
|
+
animation.stop();
|
|
108
|
+
if (timeoutHandle) {
|
|
109
|
+
clearTimeout(timeoutHandle);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
}, [selectedTabIndex, pagerViewRef]);
|
|
102
113
|
|
|
103
114
|
return (
|
|
104
115
|
<TabContainer style={containerStyle} testID={componentTestID}>
|