Skip to content

Commit

Permalink
fix: added 'onSlideEnd' to Carousel (fix: #3405) (#3515)
Browse files Browse the repository at this point in the history
  • Loading branch information
mxschmitt authored and taion committed Mar 4, 2019
1 parent d9429a9 commit b836c9c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/Carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class Carousel extends React.Component {
}

componentDidUpdate(_, prevState) {
const { bsPrefix, slide } = this.props;
const { bsPrefix, slide, onSlideEnd } = this.props;
if (
!slide ||
this.state.activeIndex === prevState.activeIndex ||
Expand Down Expand Up @@ -204,12 +204,15 @@ class Carousel extends React.Component {
currentClasses: classNames(orderClassName, directionalClassName),
},
() =>
transition.end(nextElement, () =>
transition.end(nextElement, () => {
this.safeSetState(
{ prevClasses: '', currentClasses: 'active' },
this.handleSlideEnd,
),
),
);
if (onSlideEnd) {
onSlideEnd();
}
}),
);
},
);
Expand Down

0 comments on commit b836c9c

Please sign in to comment.