Skip to content

Commit 7f22375

Browse files
committed
onSelect for prev and next buttons
1 parent 0cf52ee commit 7f22375

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/controls/carousel/Carousel.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ export class Carousel extends React.Component<ICarouselProps, ICarouselState> {
260260
if (this.props.triggerPageEvent) {
261261
// Index validation needs to be done by the parent control specyfing canMove Next|Prev
262262
nextIndex = nextButtonClicked ? (currentIndex + 1) : (currentIndex - 1);
263+
263264
// Trigger parent to provide new data
264265
this.props.triggerPageEvent(nextIndex);
265266
processingState = ProcessingState.processing;
@@ -279,6 +280,10 @@ export class Carousel extends React.Component<ICarouselProps, ICarouselState> {
279280
processingState = ProcessingState.idle;
280281
}
281282

283+
if (this.props.onSelect) {
284+
this.props.onSelect(nextIndex);
285+
}
286+
282287
this.setState({
283288
currentIndex: nextIndex,
284289
processingState

0 commit comments

Comments
 (0)