Skip to content

Commit

Permalink
fix(Carousel): added check for onActiveChange
Browse files Browse the repository at this point in the history
  • Loading branch information
vpsmolina committed Oct 31, 2023
1 parent c2a74a4 commit 7ff3cd1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/core/src/other/components/Carousel/Carousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ const Carousel = <T,>({
setCurrIndex(index);
}
typeof onActiveChange === 'function' &&
viewableItems[0]?.item &&
onActiveChange(viewableItems[0]?.item);
} else {
const length = viewableItems.length;
Expand All @@ -150,6 +151,7 @@ const Carousel = <T,>({
}

typeof onActiveChange === 'function' &&
viewableItems[middleVisibleElement]?.item &&
onActiveChange(viewableItems[middleVisibleElement]?.item);
}
},
Expand Down

0 comments on commit 7ff3cd1

Please sign in to comment.