Skip to content

Commit

Permalink
Merge pull request #19 from lad-tech/fix-carousel
Browse files Browse the repository at this point in the history
fix(Carousel): added check for onActiveChange
  • Loading branch information
vpsmolina authored Nov 1, 2023
2 parents c2a74a4 + 7ff3cd1 commit 234c402
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 234c402

Please sign in to comment.