@@ -13,11 +13,11 @@ import { useIndexController } from './hooks/useIndexController';
1313import { usePropsErrorBoundary } from './hooks/usePropsErrorBoundary' ;
1414import { ScrollViewGesture } from './ScrollViewGesture' ;
1515import { useVisibleRanges } from './hooks/useVisibleRanges' ;
16- import type { ICarouselInstance , ICarouselProps } from './types' ;
16+ import type { ICarouselInstance , TCarouselProps } from './types' ;
1717import { StyleSheet , View } from 'react-native' ;
1818
1919function Carousel < T > (
20- props : PropsWithChildren < ICarouselProps < T > > ,
20+ props : PropsWithChildren < TCarouselProps < T > > ,
2121 ref : React . Ref < ICarouselInstance >
2222) {
2323 const {
@@ -41,21 +41,19 @@ function Carousel<T>(
4141
4242 usePropsErrorBoundary ( {
4343 ...props ,
44- viewCount : _data . length ,
44+ data : _data ,
45+ mode,
46+ loop,
47+ style,
48+ defaultIndex,
49+ autoPlayInterval,
50+ panGestureHandlerProps,
4551 } ) ;
4652
47- const width = React . useMemo (
48- ( ) => Math . round ( props . width || 0 ) ,
49- [ props . width ]
50- ) ;
51- const height = React . useMemo (
52- ( ) => Math . round ( props . height || 0 ) ,
53- [ props . height ]
54- ) ;
55- const size = React . useMemo (
56- ( ) => ( vertical ? height : width ) ,
57- [ width , height , vertical ]
58- ) ;
53+ const width : number = props . vertical ? 0 : Math . round ( props . width || 0 ) ;
54+ const height : number = props . vertical ? Math . round ( props . height || 0 ) : 0 ;
55+ const size : number = vertical ? height : width ;
56+
5957 const layoutStyle = React . useMemo ( ( ) => {
6058 return {
6159 width : ! vertical ? width : '100%' ,
@@ -126,7 +124,7 @@ function Carousel<T>(
126124 return handlerOffsetX . value ;
127125 }
128126 return isNaN ( x ) ? 0 : x ;
129- } , [ loop , width , data ] ) ;
127+ } , [ loop , size , data ] ) ;
130128
131129 useAnimatedReaction (
132130 ( ) => offsetX . value ,
0 commit comments