11import React from 'react' ;
2- import Animated , { runOnJS , useDerivedValue } from 'react-native-reanimated' ;
2+ import { runOnJS , useDerivedValue } from 'react-native-reanimated' ;
33
44import { useCarouselController } from './hooks/useCarouselController' ;
55import { useAutoPlay } from './hooks/useAutoPlay' ;
@@ -8,7 +8,7 @@ import { ScrollViewGesture } from './ScrollViewGesture';
88import { useVisibleRanges } from './hooks/useVisibleRanges' ;
99
1010import type { ICarouselInstance , TCarouselProps } from './types' ;
11- import { StyleSheet , View } from 'react-native' ;
11+ import { StyleSheet } from 'react-native' ;
1212import { BaseLayout } from './layouts/BaseLayout' ;
1313import { useLayoutConfig } from './hooks/useLayoutConfig' ;
1414import { useInitProps } from './hooks/useInitProps' ;
@@ -198,40 +198,29 @@ const Carousel = React.forwardRef<ICarouselInstance, TCarouselProps<any>>(
198198
199199 return (
200200 < CTX . Provider value = { { props, common : commonVariables } } >
201- < View
201+ < ScrollViewGesture
202+ key = { mode }
203+ size = { size }
204+ translation = { handlerOffsetX }
202205 style = { [
203206 styles . container ,
204- { width : width || '100%' , height : height || '100%' } ,
207+ {
208+ width : width || '100%' ,
209+ height : height || '100%' ,
210+ } ,
205211 style ,
212+ vertical
213+ ? styles . itemsVertical
214+ : styles . itemsHorizontal ,
206215 ] }
207216 testID = { testID }
217+ onScrollBegin = { scrollViewGestureOnScrollBegin }
218+ onScrollEnd = { scrollViewGestureOnScrollEnd }
219+ onTouchBegin = { scrollViewGestureOnTouchBegin }
220+ onTouchEnd = { scrollViewGestureOnTouchEnd }
208221 >
209- < ScrollViewGesture
210- size = { size }
211- translation = { handlerOffsetX }
212- onScrollBegin = { scrollViewGestureOnScrollBegin }
213- onScrollEnd = { scrollViewGestureOnScrollEnd }
214- onTouchBegin = { scrollViewGestureOnTouchBegin }
215- onTouchEnd = { scrollViewGestureOnTouchEnd }
216- >
217- < Animated . View
218- key = { mode }
219- style = { [
220- styles . container ,
221- {
222- width : width || '100%' ,
223- height : height || '100%' ,
224- } ,
225- style ,
226- vertical
227- ? styles . itemsVertical
228- : styles . itemsHorizontal ,
229- ] }
230- >
231- { data . map ( renderLayout ) }
232- </ Animated . View >
233- </ ScrollViewGesture >
234- </ View >
222+ { data . map ( renderLayout ) }
223+ </ ScrollViewGesture >
235224 </ CTX . Provider >
236225 ) ;
237226 }
0 commit comments