Skip to content

Commit 1b45e4b

Browse files
committed
make asNavFor work with waitForAnimate=false
1 parent ca61204 commit 1b45e4b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/inner-slider.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,11 @@ export class InnerSlider extends React.Component {
387387
clearTimeout(this.animationEndCallback);
388388
}
389389
this.setState(state, () => {
390-
asNavFor && asNavFor.innerSlider.slideHandler(index);
390+
// asNavForIndex check is to avoid recursive calls of slideHandler in waitForAnimate=false mode
391+
if (asNavFor && this.asNavForIndex !== index) {
392+
this.asNavForIndex = index;
393+
asNavFor.innerSlider.slideHandler(index);
394+
}
391395
if (!nextState) return;
392396
this.animationEndCallback = setTimeout(() => {
393397
const { animating, ...firstBatch } = nextState;

0 commit comments

Comments
 (0)