Skip to content

Commit

Permalink
Fixed #1464 - Carousel page prop not detecting changes to prop value.
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Sep 19, 2020
1 parent 2d53e3d commit 794142a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/components/carousel/Carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,15 @@ export class Carousel extends Component {
}
}

if (prevProps.page !== this.props.page) {
if (this.props.page > prevProps.page && this.props.page <= (this.totalIndicators - 1)) {
this.step(-1, this.props.page);
}
else if (this.props.page < prevProps.page) {
this.step(1, this.props.page);
}
}

if (!stateChanged && this.isAutoplay()) {
this.startAutoplay();
}
Expand Down

0 comments on commit 794142a

Please sign in to comment.