@@ -250,6 +250,8 @@ function CarouselFunc(uncontrolledProps: CarouselProps, ref) {
250250 activeIndex || 0 ,
251251 ) ;
252252
253+ const intervals = useRef < number [ ] > ( [ ] ) ;
254+
253255 if ( ! isSliding && activeIndex !== renderedActiveIndex ) {
254256 if ( nextDirectionRef . current ) {
255257 setDirection ( nextDirectionRef . current ) ;
@@ -492,17 +494,23 @@ function CarouselFunc(uncontrolledProps: CarouselProps, ref) {
492494 return undefined ;
493495 }
494496
497+ let chosenInterval = interval || undefined ;
498+
499+ if ( activeIndex !== undefined && intervals . current [ activeIndex ] ) {
500+ chosenInterval = intervals . current [ activeIndex ] ;
501+ }
502+
495503 intervalHandleRef . current = window . setInterval (
496504 document . visibilityState ? nextWhenVisible : next ,
497- interval || undefined ,
505+ chosenInterval ,
498506 ) ;
499507
500508 return ( ) => {
501509 if ( intervalHandleRef . current !== null ) {
502510 clearInterval ( intervalHandleRef . current ) ;
503511 }
504512 } ;
505- } , [ shouldPlay , next , interval , nextWhenVisible ] ) ;
513+ } , [ shouldPlay , next , activeIndex , interval , nextWhenVisible ] ) ;
506514
507515 const indicatorOnClicks = useMemo (
508516 ( ) =>
@@ -547,6 +555,7 @@ function CarouselFunc(uncontrolledProps: CarouselProps, ref) {
547555 < div className = { `${ prefix } -inner` } >
548556 { map ( children , ( child , index ) => {
549557 const isActive = index === renderedActiveIndex ;
558+ intervals . current [ index ] = child . props . interval as number ;
550559
551560 return slide ? (
552561 < Transition
0 commit comments