glints-aries 4.0.270 → 4.0.271
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.
|
@@ -18,6 +18,7 @@ export var Carousel = function Carousel(_ref) {
|
|
|
18
18
|
_ref$showArrows = _ref.showArrows,
|
|
19
19
|
showArrows = _ref$showArrows === void 0 ? true : _ref$showArrows;
|
|
20
20
|
var slideRef = useRef(null);
|
|
21
|
+
var slideTimeout = useRef();
|
|
21
22
|
var _useState = useState(0),
|
|
22
23
|
activeIndex = _useState[0],
|
|
23
24
|
setActiveIndex = _useState[1];
|
|
@@ -59,7 +60,8 @@ export var Carousel = function Carousel(_ref) {
|
|
|
59
60
|
};
|
|
60
61
|
useEffect(function () {
|
|
61
62
|
if (autoRotate) {
|
|
62
|
-
|
|
63
|
+
if (slideTimeout.current) clearTimeout(slideTimeout.current);
|
|
64
|
+
slideTimeout.current = setTimeout(function () {
|
|
63
65
|
updateActiveIndex(activeIndex + 1);
|
|
64
66
|
}, duration);
|
|
65
67
|
}
|
|
@@ -24,6 +24,7 @@ var Carousel = function Carousel(_ref) {
|
|
|
24
24
|
_ref$showArrows = _ref.showArrows,
|
|
25
25
|
showArrows = _ref$showArrows === void 0 ? true : _ref$showArrows;
|
|
26
26
|
var slideRef = (0, _react.useRef)(null);
|
|
27
|
+
var slideTimeout = (0, _react.useRef)();
|
|
27
28
|
var _useState = (0, _react.useState)(0),
|
|
28
29
|
activeIndex = _useState[0],
|
|
29
30
|
setActiveIndex = _useState[1];
|
|
@@ -65,7 +66,8 @@ var Carousel = function Carousel(_ref) {
|
|
|
65
66
|
};
|
|
66
67
|
(0, _react.useEffect)(function () {
|
|
67
68
|
if (autoRotate) {
|
|
68
|
-
|
|
69
|
+
if (slideTimeout.current) clearTimeout(slideTimeout.current);
|
|
70
|
+
slideTimeout.current = setTimeout(function () {
|
|
69
71
|
updateActiveIndex(activeIndex + 1);
|
|
70
72
|
}, duration);
|
|
71
73
|
}
|