react-native-reanimated-carousel 5.0.0-beta.8 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -29
- package/lib/commonjs/components/Carousel.js +1 -1
- package/lib/commonjs/components/Carousel.js.map +1 -1
- package/lib/commonjs/components/CarouselLayout.js +1 -1
- package/lib/commonjs/components/CarouselLayout.js.map +1 -1
- package/lib/commonjs/components/ItemLayout.js +1 -1
- package/lib/commonjs/components/ItemLayout.js.map +1 -1
- package/lib/commonjs/components/ItemRenderer.js +1 -1
- package/lib/commonjs/components/ItemRenderer.js.map +1 -1
- package/lib/commonjs/components/Pagination/PaginationItem.js +2 -0
- package/lib/commonjs/components/Pagination/PaginationItem.js.map +1 -0
- package/lib/commonjs/components/Pagination/index.js +1 -1
- package/lib/commonjs/components/Pagination/index.js.map +1 -1
- package/lib/commonjs/components/ScrollViewGesture.js +1 -1
- package/lib/commonjs/components/ScrollViewGesture.js.map +1 -1
- package/lib/commonjs/hooks/useAutoPlay.js +1 -1
- package/lib/commonjs/hooks/useAutoPlay.js.map +1 -1
- package/lib/commonjs/hooks/useCarouselController.js +1 -1
- package/lib/commonjs/hooks/useCarouselController.js.map +1 -1
- package/lib/commonjs/hooks/useCommonVariables.js +1 -1
- package/lib/commonjs/hooks/useCommonVariables.js.map +1 -1
- package/lib/commonjs/hooks/useInitProps.js +1 -1
- package/lib/commonjs/hooks/useInitProps.js.map +1 -1
- package/lib/commonjs/hooks/useLayoutConfig.js +1 -1
- package/lib/commonjs/hooks/useLayoutConfig.js.map +1 -1
- package/lib/commonjs/hooks/useOffsetX.js.map +1 -1
- package/lib/commonjs/hooks/useOnProgressChange.js +1 -1
- package/lib/commonjs/hooks/useOnProgressChange.js.map +1 -1
- package/lib/commonjs/hooks/usePanGestureProxy.js.map +1 -1
- package/lib/commonjs/hooks/usePropsErrorBoundary.js +1 -1
- package/lib/commonjs/hooks/usePropsErrorBoundary.js.map +1 -1
- package/lib/commonjs/hooks/useUpdateGestureConfig.js.map +1 -1
- package/lib/commonjs/hooks/useVisibleRanges.js.map +1 -1
- package/lib/commonjs/index.js +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/layouts/index.js.map +1 -1
- package/lib/commonjs/layouts/normal.js +1 -1
- package/lib/commonjs/layouts/normal.js.map +1 -1
- package/lib/commonjs/layouts/parallax.js +1 -1
- package/lib/commonjs/layouts/parallax.js.map +1 -1
- package/lib/commonjs/layouts/stack.js +1 -1
- package/lib/commonjs/layouts/stack.js.map +1 -1
- package/lib/commonjs/public-types.js +2 -0
- package/lib/commonjs/public-types.js.map +1 -0
- package/lib/commonjs/store/index.js.map +1 -1
- package/lib/commonjs/utils/carousel-direction.js +2 -0
- package/lib/commonjs/utils/carousel-direction.js.map +1 -0
- package/lib/commonjs/utils/carousel-math.js +2 -0
- package/lib/commonjs/utils/carousel-math.js.map +1 -0
- package/lib/commonjs/utils/computed-with-auto-fill-data.js.map +1 -1
- package/lib/commonjs/utils/deal-with-animation.js +1 -1
- package/lib/commonjs/utils/deal-with-animation.js.map +1 -1
- package/lib/module/components/Carousel.js +1 -1
- package/lib/module/components/Carousel.js.map +1 -1
- package/lib/module/components/CarouselLayout.js +1 -1
- package/lib/module/components/CarouselLayout.js.map +1 -1
- package/lib/module/components/ItemLayout.js +1 -1
- package/lib/module/components/ItemLayout.js.map +1 -1
- package/lib/module/components/ItemRenderer.js +1 -1
- package/lib/module/components/ItemRenderer.js.map +1 -1
- package/lib/module/components/LazyView.js +1 -1
- package/lib/module/components/LazyView.js.map +1 -1
- package/lib/module/components/Pagination/PaginationItem.js +2 -0
- package/lib/module/components/Pagination/PaginationItem.js.map +1 -0
- package/lib/module/components/Pagination/index.js +1 -1
- package/lib/module/components/Pagination/index.js.map +1 -1
- package/lib/module/components/ScrollViewGesture.js +1 -1
- package/lib/module/components/ScrollViewGesture.js.map +1 -1
- package/lib/module/constants/index.js +1 -1
- package/lib/module/constants/index.js.map +1 -1
- package/lib/module/hooks/useAutoPlay.js +1 -1
- package/lib/module/hooks/useAutoPlay.js.map +1 -1
- package/lib/module/hooks/useCarouselController.js +1 -1
- package/lib/module/hooks/useCarouselController.js.map +1 -1
- package/lib/module/hooks/useCheckMounted.js +1 -1
- package/lib/module/hooks/useCheckMounted.js.map +1 -1
- package/lib/module/hooks/useCommonVariables.js +1 -1
- package/lib/module/hooks/useCommonVariables.js.map +1 -1
- package/lib/module/hooks/useInitProps.js +1 -1
- package/lib/module/hooks/useInitProps.js.map +1 -1
- package/lib/module/hooks/useLayoutConfig.js +1 -1
- package/lib/module/hooks/useLayoutConfig.js.map +1 -1
- package/lib/module/hooks/useOffsetX.js +1 -1
- package/lib/module/hooks/useOffsetX.js.map +1 -1
- package/lib/module/hooks/useOnProgressChange.js +1 -1
- package/lib/module/hooks/useOnProgressChange.js.map +1 -1
- package/lib/module/hooks/usePanGestureProxy.js +1 -1
- package/lib/module/hooks/usePanGestureProxy.js.map +1 -1
- package/lib/module/hooks/usePropsErrorBoundary.js +1 -1
- package/lib/module/hooks/usePropsErrorBoundary.js.map +1 -1
- package/lib/module/hooks/useUpdateGestureConfig.js +1 -1
- package/lib/module/hooks/useUpdateGestureConfig.js.map +1 -1
- package/lib/module/hooks/useVisibleRanges.js +1 -1
- package/lib/module/hooks/useVisibleRanges.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/layouts/index.js +1 -1
- package/lib/module/layouts/index.js.map +1 -1
- package/lib/module/layouts/normal.js +1 -1
- package/lib/module/layouts/normal.js.map +1 -1
- package/lib/module/layouts/parallax.js +1 -1
- package/lib/module/layouts/parallax.js.map +1 -1
- package/lib/module/layouts/stack.js +1 -1
- package/lib/module/layouts/stack.js.map +1 -1
- package/lib/module/package.json +1 -0
- package/lib/module/public-types.js +2 -0
- package/lib/module/public-types.js.map +1 -0
- package/lib/module/store/index.js +1 -1
- package/lib/module/store/index.js.map +1 -1
- package/lib/module/types.js +1 -1
- package/lib/module/utils/carousel-direction.js +2 -0
- package/lib/module/utils/carousel-direction.js.map +1 -0
- package/lib/module/utils/carousel-math.js +2 -0
- package/lib/module/utils/carousel-math.js.map +1 -0
- package/lib/module/utils/compute-gesture-translation.js +1 -1
- package/lib/module/utils/compute-gesture-translation.js.map +1 -1
- package/lib/module/utils/compute-offset-if-size-changed.js +1 -1
- package/lib/module/utils/compute-offset-if-size-changed.js.map +1 -1
- package/lib/module/utils/computed-with-auto-fill-data.js +1 -1
- package/lib/module/utils/computed-with-auto-fill-data.js.map +1 -1
- package/lib/module/utils/deal-with-animation.js +1 -1
- package/lib/module/utils/deal-with-animation.js.map +1 -1
- package/lib/module/utils/log.js +1 -1
- package/lib/module/utils/log.js.map +1 -1
- package/lib/module/utils/sanitize-animation-style.js +1 -1
- package/lib/module/utils/sanitize-animation-style.js.map +1 -1
- package/lib/typescript/commonjs/components/Carousel.d.ts +8 -0
- package/lib/typescript/commonjs/components/Carousel.d.ts.map +1 -0
- package/lib/typescript/{components → commonjs/components}/CarouselLayout.d.ts +5 -8
- package/lib/typescript/commonjs/components/CarouselLayout.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/ItemLayout.d.ts +21 -0
- package/lib/typescript/commonjs/components/ItemLayout.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/ItemRenderer.d.ts +24 -0
- package/lib/typescript/commonjs/components/ItemRenderer.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/LazyView.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Pagination/PaginationItem.d.ts +14 -0
- package/lib/typescript/commonjs/components/Pagination/PaginationItem.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Pagination/index.d.ts +4 -0
- package/lib/typescript/commonjs/components/Pagination/index.d.ts.map +1 -0
- package/lib/typescript/{components → commonjs/components}/ScrollViewGesture.d.ts +3 -4
- package/lib/typescript/commonjs/components/ScrollViewGesture.d.ts.map +1 -0
- package/lib/typescript/commonjs/constants/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/hooks/useAutoPlay.d.ts +12 -0
- package/lib/typescript/commonjs/hooks/useAutoPlay.d.ts.map +1 -0
- package/lib/typescript/commonjs/hooks/useCarouselController.d.ts +29 -0
- package/lib/typescript/commonjs/hooks/useCarouselController.d.ts.map +1 -0
- package/lib/typescript/commonjs/hooks/useCheckMounted.d.ts.map +1 -0
- package/lib/typescript/commonjs/hooks/useCommonVariables.d.ts +18 -0
- package/lib/typescript/commonjs/hooks/useCommonVariables.d.ts.map +1 -0
- package/lib/typescript/commonjs/hooks/useInitProps.d.ts +25 -0
- package/lib/typescript/commonjs/hooks/useInitProps.d.ts.map +1 -0
- package/lib/typescript/commonjs/hooks/useLayoutConfig.d.ts +8 -0
- package/lib/typescript/commonjs/hooks/useLayoutConfig.d.ts.map +1 -0
- package/lib/typescript/commonjs/hooks/useOffsetX.d.ts +13 -0
- package/lib/typescript/commonjs/hooks/useOffsetX.d.ts.map +1 -0
- package/lib/typescript/commonjs/hooks/useOnProgressChange.d.ts +12 -0
- package/lib/typescript/commonjs/hooks/useOnProgressChange.d.ts.map +1 -0
- package/lib/typescript/{hooks → commonjs/hooks}/usePanGestureProxy.d.ts +4 -3
- package/lib/typescript/commonjs/hooks/usePanGestureProxy.d.ts.map +1 -0
- package/lib/typescript/commonjs/hooks/usePropsErrorBoundary.d.ts +3 -0
- package/lib/typescript/commonjs/hooks/usePropsErrorBoundary.d.ts.map +1 -0
- package/lib/typescript/commonjs/hooks/useUpdateGestureConfig.d.ts +9 -0
- package/lib/typescript/commonjs/hooks/useUpdateGestureConfig.d.ts.map +1 -0
- package/lib/typescript/{hooks → commonjs/hooks}/useVisibleRanges.d.ts +6 -6
- package/lib/typescript/commonjs/hooks/useVisibleRanges.d.ts.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +4 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -0
- package/lib/typescript/{layouts → commonjs/layouts}/index.d.ts +0 -1
- package/lib/typescript/commonjs/layouts/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/layouts/normal.d.ts +15 -0
- package/lib/typescript/commonjs/layouts/normal.d.ts.map +1 -0
- package/lib/typescript/commonjs/layouts/parallax.d.ts +27 -0
- package/lib/typescript/commonjs/layouts/parallax.d.ts.map +1 -0
- package/lib/typescript/commonjs/layouts/stack.d.ts +10 -0
- package/lib/typescript/commonjs/layouts/stack.d.ts.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/public-types.d.ts +171 -0
- package/lib/typescript/commonjs/public-types.d.ts.map +1 -0
- package/lib/typescript/{store → commonjs/store}/index.d.ts +8 -8
- package/lib/typescript/commonjs/store/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/types.d.ts +15 -0
- package/lib/typescript/commonjs/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/utils/carousel-direction.d.ts +9 -0
- package/lib/typescript/commonjs/utils/carousel-direction.d.ts.map +1 -0
- package/lib/typescript/commonjs/utils/carousel-math.d.ts +28 -0
- package/lib/typescript/commonjs/utils/carousel-math.d.ts.map +1 -0
- package/lib/typescript/commonjs/utils/compute-gesture-translation.d.ts.map +1 -0
- package/lib/typescript/commonjs/utils/compute-offset-if-size-changed.d.ts.map +1 -0
- package/lib/typescript/commonjs/utils/computed-with-auto-fill-data.d.ts.map +1 -0
- package/lib/typescript/commonjs/utils/deal-with-animation.d.ts +3 -0
- package/lib/typescript/commonjs/utils/deal-with-animation.d.ts.map +1 -0
- package/lib/typescript/commonjs/utils/log.d.ts.map +1 -0
- package/lib/typescript/commonjs/utils/sanitize-animation-style.d.ts.map +1 -0
- package/lib/typescript/module/components/Carousel.d.ts +8 -0
- package/lib/typescript/module/components/Carousel.d.ts.map +1 -0
- package/lib/typescript/module/components/CarouselLayout.d.ts +14 -0
- package/lib/typescript/module/components/CarouselLayout.d.ts.map +1 -0
- package/lib/typescript/module/components/ItemLayout.d.ts +21 -0
- package/lib/typescript/module/components/ItemLayout.d.ts.map +1 -0
- package/lib/typescript/module/components/ItemRenderer.d.ts +24 -0
- package/lib/typescript/module/components/ItemRenderer.d.ts.map +1 -0
- package/lib/typescript/module/components/LazyView.d.ts +8 -0
- package/lib/typescript/module/components/LazyView.d.ts.map +1 -0
- package/lib/typescript/module/components/Pagination/PaginationItem.d.ts +14 -0
- package/lib/typescript/module/components/Pagination/PaginationItem.d.ts.map +1 -0
- package/lib/typescript/module/components/Pagination/index.d.ts +4 -0
- package/lib/typescript/module/components/Pagination/index.d.ts.map +1 -0
- package/lib/typescript/module/components/ScrollViewGesture.d.ts +18 -0
- package/lib/typescript/module/components/ScrollViewGesture.d.ts.map +1 -0
- package/lib/typescript/module/constants/index.d.ts +9 -0
- package/lib/typescript/module/constants/index.d.ts.map +1 -0
- package/lib/typescript/module/hooks/useAutoPlay.d.ts +12 -0
- package/lib/typescript/module/hooks/useAutoPlay.d.ts.map +1 -0
- package/lib/typescript/module/hooks/useCarouselController.d.ts +29 -0
- package/lib/typescript/module/hooks/useCarouselController.d.ts.map +1 -0
- package/lib/typescript/module/hooks/useCheckMounted.d.ts +3 -0
- package/lib/typescript/module/hooks/useCheckMounted.d.ts.map +1 -0
- package/lib/typescript/module/hooks/useCommonVariables.d.ts +18 -0
- package/lib/typescript/module/hooks/useCommonVariables.d.ts.map +1 -0
- package/lib/typescript/module/hooks/useInitProps.d.ts +25 -0
- package/lib/typescript/module/hooks/useInitProps.d.ts.map +1 -0
- package/lib/typescript/module/hooks/useLayoutConfig.d.ts +8 -0
- package/lib/typescript/module/hooks/useLayoutConfig.d.ts.map +1 -0
- package/lib/typescript/module/hooks/useOffsetX.d.ts +13 -0
- package/lib/typescript/module/hooks/useOffsetX.d.ts.map +1 -0
- package/lib/typescript/module/hooks/useOnProgressChange.d.ts +12 -0
- package/lib/typescript/module/hooks/useOnProgressChange.d.ts.map +1 -0
- package/lib/typescript/module/hooks/usePanGestureProxy.d.ts +11 -0
- package/lib/typescript/module/hooks/usePanGestureProxy.d.ts.map +1 -0
- package/lib/typescript/module/hooks/usePropsErrorBoundary.d.ts +3 -0
- package/lib/typescript/module/hooks/usePropsErrorBoundary.d.ts.map +1 -0
- package/lib/typescript/module/hooks/useUpdateGestureConfig.d.ts +9 -0
- package/lib/typescript/module/hooks/useUpdateGestureConfig.d.ts.map +1 -0
- package/lib/typescript/module/hooks/useVisibleRanges.d.ts +22 -0
- package/lib/typescript/module/hooks/useVisibleRanges.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +4 -0
- package/lib/typescript/module/index.d.ts.map +1 -0
- package/lib/typescript/module/layouts/index.d.ts +10 -0
- package/lib/typescript/module/layouts/index.d.ts.map +1 -0
- package/lib/typescript/module/layouts/normal.d.ts +15 -0
- package/lib/typescript/module/layouts/normal.d.ts.map +1 -0
- package/lib/typescript/module/layouts/parallax.d.ts +27 -0
- package/lib/typescript/module/layouts/parallax.d.ts.map +1 -0
- package/lib/typescript/module/layouts/stack.d.ts +10 -0
- package/lib/typescript/module/layouts/stack.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/public-types.d.ts +171 -0
- package/lib/typescript/module/public-types.d.ts.map +1 -0
- package/lib/typescript/module/store/index.d.ts +35 -0
- package/lib/typescript/module/store/index.d.ts.map +1 -0
- package/lib/typescript/module/types.d.ts +15 -0
- package/lib/typescript/module/types.d.ts.map +1 -0
- package/lib/typescript/module/utils/carousel-direction.d.ts +9 -0
- package/lib/typescript/module/utils/carousel-direction.d.ts.map +1 -0
- package/lib/typescript/module/utils/carousel-math.d.ts +28 -0
- package/lib/typescript/module/utils/carousel-math.d.ts.map +1 -0
- package/lib/typescript/module/utils/compute-gesture-translation.d.ts +9 -0
- package/lib/typescript/module/utils/compute-gesture-translation.d.ts.map +1 -0
- package/lib/typescript/module/utils/compute-offset-if-size-changed.d.ts +6 -0
- package/lib/typescript/module/utils/compute-offset-if-size-changed.d.ts.map +1 -0
- package/lib/typescript/module/utils/computed-with-auto-fill-data.d.ts +23 -0
- package/lib/typescript/module/utils/computed-with-auto-fill-data.d.ts.map +1 -0
- package/lib/typescript/module/utils/deal-with-animation.d.ts +3 -0
- package/lib/typescript/module/utils/deal-with-animation.d.ts.map +1 -0
- package/lib/typescript/module/utils/log.d.ts +7 -0
- package/lib/typescript/module/utils/log.d.ts.map +1 -0
- package/lib/typescript/module/utils/sanitize-animation-style.d.ts +3 -0
- package/lib/typescript/module/utils/sanitize-animation-style.d.ts.map +1 -0
- package/package.json +31 -6
- package/scripts/codemods/v5.mjs +502 -0
- package/src/components/Carousel.tsx +5 -5
- package/src/components/CarouselLayout.tsx +52 -89
- package/src/components/ItemLayout.tsx +57 -48
- package/src/components/ItemRenderer.tsx +29 -18
- package/src/components/Pagination/PaginationItem.tsx +166 -0
- package/src/components/Pagination/index.tsx +105 -6
- package/src/components/ScrollViewGesture.tsx +92 -177
- package/src/hooks/useAutoPlay.ts +23 -18
- package/src/hooks/useCarouselController.tsx +196 -342
- package/src/hooks/useCommonVariables.ts +159 -71
- package/src/hooks/useInitProps.ts +161 -71
- package/src/hooks/useLayoutConfig.ts +21 -12
- package/src/hooks/useOffsetX.ts +6 -6
- package/src/hooks/useOnProgressChange.ts +23 -48
- package/src/hooks/usePanGestureProxy.ts +8 -8
- package/src/hooks/usePropsErrorBoundary.ts +32 -90
- package/src/hooks/useUpdateGestureConfig.ts +6 -3
- package/src/hooks/useVisibleRanges.tsx +6 -6
- package/src/index.tsx +14 -9
- package/src/layouts/index.tsx +0 -2
- package/src/layouts/normal.ts +14 -4
- package/src/layouts/parallax.ts +32 -59
- package/src/layouts/stack.ts +30 -70
- package/src/public-types.ts +209 -0
- package/src/store/index.tsx +7 -7
- package/src/types.ts +30 -322
- package/src/utils/carousel-direction.ts +39 -0
- package/src/utils/carousel-math.ts +156 -0
- package/src/utils/computed-with-auto-fill-data.ts +2 -2
- package/src/utils/deal-with-animation.ts +11 -9
- package/lib/commonjs/components/Pagination/Basic/PaginationItem.js +0 -2
- package/lib/commonjs/components/Pagination/Basic/PaginationItem.js.map +0 -1
- package/lib/commonjs/components/Pagination/Basic/index.js +0 -2
- package/lib/commonjs/components/Pagination/Basic/index.js.map +0 -1
- package/lib/commonjs/components/Pagination/Custom/PaginationItem.js +0 -2
- package/lib/commonjs/components/Pagination/Custom/PaginationItem.js.map +0 -1
- package/lib/commonjs/components/Pagination/Custom/index.js +0 -2
- package/lib/commonjs/components/Pagination/Custom/index.js.map +0 -1
- package/lib/commonjs/utils/compute-offset-if-data-changed.js +0 -2
- package/lib/commonjs/utils/compute-offset-if-data-changed.js.map +0 -1
- package/lib/commonjs/utils/handleroffset-direction.js +0 -2
- package/lib/commonjs/utils/handleroffset-direction.js.map +0 -1
- package/lib/module/components/Pagination/Basic/PaginationItem.js +0 -2
- package/lib/module/components/Pagination/Basic/PaginationItem.js.map +0 -1
- package/lib/module/components/Pagination/Basic/index.js +0 -2
- package/lib/module/components/Pagination/Basic/index.js.map +0 -1
- package/lib/module/components/Pagination/Custom/PaginationItem.js +0 -2
- package/lib/module/components/Pagination/Custom/PaginationItem.js.map +0 -1
- package/lib/module/components/Pagination/Custom/index.js +0 -2
- package/lib/module/components/Pagination/Custom/index.js.map +0 -1
- package/lib/module/utils/compute-offset-if-data-changed.js +0 -2
- package/lib/module/utils/compute-offset-if-data-changed.js.map +0 -1
- package/lib/module/utils/handleroffset-direction.js +0 -2
- package/lib/module/utils/handleroffset-direction.js.map +0 -1
- package/lib/typescript/components/Carousel.d.ts +0 -8
- package/lib/typescript/components/Carousel.d.ts.map +0 -1
- package/lib/typescript/components/CarouselLayout.d.ts.map +0 -1
- package/lib/typescript/components/ItemLayout.d.ts +0 -20
- package/lib/typescript/components/ItemLayout.d.ts.map +0 -1
- package/lib/typescript/components/ItemRenderer.d.ts +0 -23
- package/lib/typescript/components/ItemRenderer.d.ts.map +0 -1
- package/lib/typescript/components/LazyView.d.ts.map +0 -1
- package/lib/typescript/components/Pagination/Basic/PaginationItem.d.ts +0 -29
- package/lib/typescript/components/Pagination/Basic/PaginationItem.d.ts.map +0 -1
- package/lib/typescript/components/Pagination/Basic/index.d.ts +0 -23
- package/lib/typescript/components/Pagination/Basic/index.d.ts.map +0 -1
- package/lib/typescript/components/Pagination/Custom/PaginationItem.d.ts +0 -35
- package/lib/typescript/components/Pagination/Custom/PaginationItem.d.ts.map +0 -1
- package/lib/typescript/components/Pagination/Custom/index.d.ts +0 -26
- package/lib/typescript/components/Pagination/Custom/index.d.ts.map +0 -1
- package/lib/typescript/components/Pagination/index.d.ts +0 -5
- package/lib/typescript/components/Pagination/index.d.ts.map +0 -1
- package/lib/typescript/components/ScrollViewGesture.d.ts.map +0 -1
- package/lib/typescript/constants/index.d.ts.map +0 -1
- package/lib/typescript/hooks/useAutoPlay.d.ts +0 -12
- package/lib/typescript/hooks/useAutoPlay.d.ts.map +0 -1
- package/lib/typescript/hooks/useCarouselController.d.ts +0 -28
- package/lib/typescript/hooks/useCarouselController.d.ts.map +0 -1
- package/lib/typescript/hooks/useCheckMounted.d.ts.map +0 -1
- package/lib/typescript/hooks/useCommonVariables.d.ts +0 -13
- package/lib/typescript/hooks/useCommonVariables.d.ts.map +0 -1
- package/lib/typescript/hooks/useInitProps.d.ts +0 -10
- package/lib/typescript/hooks/useInitProps.d.ts.map +0 -1
- package/lib/typescript/hooks/useLayoutConfig.d.ts +0 -8
- package/lib/typescript/hooks/useLayoutConfig.d.ts.map +0 -1
- package/lib/typescript/hooks/useOffsetX.d.ts +0 -13
- package/lib/typescript/hooks/useOffsetX.d.ts.map +0 -1
- package/lib/typescript/hooks/useOnProgressChange.d.ts +0 -11
- package/lib/typescript/hooks/useOnProgressChange.d.ts.map +0 -1
- package/lib/typescript/hooks/usePanGestureProxy.d.ts.map +0 -1
- package/lib/typescript/hooks/usePropsErrorBoundary.d.ts +0 -5
- package/lib/typescript/hooks/usePropsErrorBoundary.d.ts.map +0 -1
- package/lib/typescript/hooks/useUpdateGestureConfig.d.ts +0 -6
- package/lib/typescript/hooks/useUpdateGestureConfig.d.ts.map +0 -1
- package/lib/typescript/hooks/useVisibleRanges.d.ts.map +0 -1
- package/lib/typescript/index.d.ts +0 -7
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/layouts/index.d.ts.map +0 -1
- package/lib/typescript/layouts/normal.d.ts +0 -13
- package/lib/typescript/layouts/normal.d.ts.map +0 -1
- package/lib/typescript/layouts/parallax.d.ts +0 -47
- package/lib/typescript/layouts/parallax.d.ts.map +0 -1
- package/lib/typescript/layouts/stack.d.ts +0 -38
- package/lib/typescript/layouts/stack.d.ts.map +0 -1
- package/lib/typescript/store/index.d.ts.map +0 -1
- package/lib/typescript/types.d.ts +0 -302
- package/lib/typescript/types.d.ts.map +0 -1
- package/lib/typescript/utils/compute-gesture-translation.d.ts.map +0 -1
- package/lib/typescript/utils/compute-offset-if-data-changed.d.ts +0 -9
- package/lib/typescript/utils/compute-offset-if-data-changed.d.ts.map +0 -1
- package/lib/typescript/utils/compute-offset-if-size-changed.d.ts.map +0 -1
- package/lib/typescript/utils/computed-with-auto-fill-data.d.ts.map +0 -1
- package/lib/typescript/utils/deal-with-animation.d.ts +0 -3
- package/lib/typescript/utils/deal-with-animation.d.ts.map +0 -1
- package/lib/typescript/utils/handleroffset-direction.d.ts +0 -4
- package/lib/typescript/utils/handleroffset-direction.d.ts.map +0 -1
- package/lib/typescript/utils/log.d.ts.map +0 -1
- package/lib/typescript/utils/sanitize-animation-style.d.ts.map +0 -1
- package/src/components/Pagination/Basic/PaginationItem.tsx +0 -149
- package/src/components/Pagination/Basic/index.tsx +0 -98
- package/src/components/Pagination/Custom/PaginationItem.tsx +0 -166
- package/src/components/Pagination/Custom/index.tsx +0 -111
- package/src/utils/compute-offset-if-data-changed.ts +0 -44
- package/src/utils/handleroffset-direction.ts +0 -18
- /package/lib/typescript/{components → commonjs/components}/LazyView.d.ts +0 -0
- /package/lib/typescript/{constants → commonjs/constants}/index.d.ts +0 -0
- /package/lib/typescript/{hooks → commonjs/hooks}/useCheckMounted.d.ts +0 -0
- /package/lib/typescript/{utils → commonjs/utils}/compute-gesture-translation.d.ts +0 -0
- /package/lib/typescript/{utils → commonjs/utils}/compute-offset-if-size-changed.d.ts +0 -0
- /package/lib/typescript/{utils → commonjs/utils}/computed-with-auto-fill-data.d.ts +0 -0
- /package/lib/typescript/{utils → commonjs/utils}/log.d.ts +0 -0
- /package/lib/typescript/{utils → commonjs/utils}/sanitize-animation-style.d.ts +0 -0
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
import type { ColorValue, LayoutChangeEvent, StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
import type {
|
|
4
|
+
GestureStateChangeEvent,
|
|
5
|
+
GestureType,
|
|
6
|
+
GestureUpdateEvent,
|
|
7
|
+
MouseButton,
|
|
8
|
+
PanGesture,
|
|
9
|
+
PanGestureChangeEventPayload,
|
|
10
|
+
PanGestureHandlerEventPayload,
|
|
11
|
+
PanGestureHandlerProps,
|
|
12
|
+
} from "react-native-gesture-handler";
|
|
13
|
+
import type { SharedValue, WithSpringConfig, WithTimingConfig } from "react-native-reanimated";
|
|
14
|
+
|
|
15
|
+
type CarouselOrientation = "horizontal" | "vertical";
|
|
16
|
+
type CarouselSnapMode = "page" | "nearest" | "none";
|
|
17
|
+
type CarouselAutoplayDirection = "forward" | "backward";
|
|
18
|
+
type CarouselExitDirection = "left" | "right";
|
|
19
|
+
|
|
20
|
+
type CarouselContentContainerStyle = Omit<ViewStyle, "opacity" | "transform">;
|
|
21
|
+
|
|
22
|
+
type CarouselExternalGestureRef =
|
|
23
|
+
| GestureType
|
|
24
|
+
| React.RefObject<GestureType | undefined>
|
|
25
|
+
| React.RefObject<React.ComponentType | undefined>;
|
|
26
|
+
|
|
27
|
+
type CarouselPanStateEvent = GestureStateChangeEvent<PanGestureHandlerEventPayload>;
|
|
28
|
+
type CarouselPanUpdateEvent = GestureUpdateEvent<PanGestureHandlerEventPayload>;
|
|
29
|
+
type CarouselPanChangeEvent = GestureUpdateEvent<
|
|
30
|
+
PanGestureHandlerEventPayload & PanGestureChangeEventPayload
|
|
31
|
+
>;
|
|
32
|
+
|
|
33
|
+
type CarouselLayoutSelection =
|
|
34
|
+
| {
|
|
35
|
+
layout?: CarouselLayout;
|
|
36
|
+
itemAnimation?: never;
|
|
37
|
+
}
|
|
38
|
+
| {
|
|
39
|
+
layout?: never;
|
|
40
|
+
itemAnimation: CarouselItemAnimation;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
type InteractivePaginationProps = {
|
|
44
|
+
onPress: (index: number) => void;
|
|
45
|
+
getItemAccessibilityLabel?: (index: number, count: number) => string;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
type DecorativePaginationProps = {
|
|
49
|
+
onPress?: never;
|
|
50
|
+
getItemAccessibilityLabel?: never;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
type ReadonlyProgressValue = Omit<SharedValue<number>, "modify" | "set" | "value"> & {
|
|
54
|
+
readonly value: number;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
type PaginationBaseProps = {
|
|
58
|
+
count: number;
|
|
59
|
+
progress: ReadonlyProgressValue;
|
|
60
|
+
orientation?: CarouselOrientation;
|
|
61
|
+
containerStyle?: StyleProp<Omit<ViewStyle, "direction" | "flexDirection">>;
|
|
62
|
+
dotStyle?: PaginationDotStyle;
|
|
63
|
+
activeDotStyle?: PaginationDotStyle;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export type CarouselProps<Item> = {
|
|
67
|
+
data: Item[];
|
|
68
|
+
renderItem: CarouselRenderItem<Item>;
|
|
69
|
+
keyExtractor?: (item: Item, index: number) => string;
|
|
70
|
+
defaultIndex?: number;
|
|
71
|
+
loop?: boolean;
|
|
72
|
+
autoplay?: boolean;
|
|
73
|
+
autoplayInterval?: number;
|
|
74
|
+
autoplayDirection?: CarouselAutoplayDirection;
|
|
75
|
+
orientation?: CarouselOrientation;
|
|
76
|
+
itemSize?: number;
|
|
77
|
+
scrollEnabled?: boolean;
|
|
78
|
+
snapMode?: CarouselSnapMode;
|
|
79
|
+
overscrollEnabled?: boolean;
|
|
80
|
+
renderWindowSize?: number;
|
|
81
|
+
animation?: CarouselAnimation;
|
|
82
|
+
progress?: SharedValue<number>;
|
|
83
|
+
onProgressChange?: CarouselProgressChangeHandler;
|
|
84
|
+
scrollOffsetValue?: SharedValue<number>;
|
|
85
|
+
style?: StyleProp<ViewStyle>;
|
|
86
|
+
contentContainerStyle?: StyleProp<CarouselContentContainerStyle>;
|
|
87
|
+
testID?: string;
|
|
88
|
+
onLayout?: (event: LayoutChangeEvent) => void;
|
|
89
|
+
onConfigurePanGesture?: (gesture: CarouselPanGesture) => void;
|
|
90
|
+
onScrollStart?: () => void;
|
|
91
|
+
onSnapToItem?: (index: number) => void;
|
|
92
|
+
} & CarouselLayoutSelection;
|
|
93
|
+
|
|
94
|
+
export interface CarouselRef {
|
|
95
|
+
prev(options?: CarouselStepOptions): void;
|
|
96
|
+
next(options?: CarouselStepOptions): void;
|
|
97
|
+
getCurrentIndex(): number;
|
|
98
|
+
scrollTo(options: CarouselScrollToOptions): void;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export type CarouselRenderItem<Item> = (info: CarouselRenderItemInfo<Item>) => React.ReactElement;
|
|
102
|
+
|
|
103
|
+
export interface CarouselRenderItemInfo<Item> {
|
|
104
|
+
item: Item;
|
|
105
|
+
index: number;
|
|
106
|
+
relativeProgress: SharedValue<number>;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export type CarouselProgressChangeHandler = (progress: number) => void;
|
|
110
|
+
|
|
111
|
+
export type CarouselLayout =
|
|
112
|
+
| {
|
|
113
|
+
type: "parallax";
|
|
114
|
+
offset?: number;
|
|
115
|
+
scale?: number;
|
|
116
|
+
adjacentScale?: number;
|
|
117
|
+
}
|
|
118
|
+
| {
|
|
119
|
+
type: "horizontal-stack";
|
|
120
|
+
visibleCount?: number;
|
|
121
|
+
exitDistance?: number;
|
|
122
|
+
spacing?: number;
|
|
123
|
+
scaleStep?: number;
|
|
124
|
+
opacityStep?: number;
|
|
125
|
+
rotation?: number;
|
|
126
|
+
exitDirection?: CarouselExitDirection;
|
|
127
|
+
}
|
|
128
|
+
| {
|
|
129
|
+
type: "vertical-stack";
|
|
130
|
+
visibleCount?: number;
|
|
131
|
+
exitDistance?: number;
|
|
132
|
+
spacing?: number;
|
|
133
|
+
scaleStep?: number;
|
|
134
|
+
opacityStep?: number;
|
|
135
|
+
rotation?: number;
|
|
136
|
+
exitDirection?: CarouselExitDirection;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
export type CarouselAnimation =
|
|
140
|
+
| ({ type: "timing" } & WithTimingConfig)
|
|
141
|
+
| ({ type: "spring" } & WithSpringConfig);
|
|
142
|
+
|
|
143
|
+
export type CarouselItemAnimation = (relativeProgress: number, index: number) => ViewStyle;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Supported configuration surface for Carousel's real RNGH pan gesture.
|
|
147
|
+
*
|
|
148
|
+
* Methods return this facade so chaining never exposes ownership-changing RNGH
|
|
149
|
+
* methods such as `enabled`, `runOnJS`, or `manualActivation`.
|
|
150
|
+
*/
|
|
151
|
+
export interface CarouselPanGesture {
|
|
152
|
+
/**
|
|
153
|
+
* Controlled view of the underlying RNGH pan gesture configuration.
|
|
154
|
+
*
|
|
155
|
+
* Exposes the web-only `touchAction` option (e.g. `"pan-y"` so a
|
|
156
|
+
* horizontal carousel nested in a vertically scrollable page keeps native
|
|
157
|
+
* vertical scrolling on mobile web) without casting away the facade.
|
|
158
|
+
* Ownership-changing options such as `enabled`, `runOnJS`, or
|
|
159
|
+
* `manualActivation` intentionally stay hidden.
|
|
160
|
+
*/
|
|
161
|
+
readonly config: Pick<PanGesture["config"], "touchAction">;
|
|
162
|
+
activeOffsetX(offset: number | [start: number, end: number]): this;
|
|
163
|
+
activeOffsetY(offset: number | [start: number, end: number]): this;
|
|
164
|
+
failOffsetX(offset: number | [start: number, end: number]): this;
|
|
165
|
+
failOffsetY(offset: number | [start: number, end: number]): this;
|
|
166
|
+
minPointers(count: number): this;
|
|
167
|
+
maxPointers(count: number): this;
|
|
168
|
+
minDistance(distance: number): this;
|
|
169
|
+
minVelocity(velocity: number): this;
|
|
170
|
+
minVelocityX(velocity: number): this;
|
|
171
|
+
minVelocityY(velocity: number): this;
|
|
172
|
+
averageTouches(value: boolean): this;
|
|
173
|
+
enableTrackpadTwoFingerGesture(value: boolean): this;
|
|
174
|
+
activateAfterLongPress(duration: number): this;
|
|
175
|
+
hitSlop(value: PanGestureHandlerProps["hitSlop"]): this;
|
|
176
|
+
mouseButton(button: MouseButton): this;
|
|
177
|
+
simultaneousWithExternalGesture(...gestures: CarouselExternalGestureRef[]): this;
|
|
178
|
+
requireExternalGestureToFail(...gestures: CarouselExternalGestureRef[]): this;
|
|
179
|
+
blocksExternalGesture(...gestures: CarouselExternalGestureRef[]): this;
|
|
180
|
+
onBegin(callback: (event: CarouselPanStateEvent) => void): this;
|
|
181
|
+
onStart(callback: (event: CarouselPanStateEvent) => void): this;
|
|
182
|
+
onUpdate(callback: (event: CarouselPanUpdateEvent) => void): this;
|
|
183
|
+
onChange(callback: (event: CarouselPanChangeEvent) => void): this;
|
|
184
|
+
onEnd(callback: (event: CarouselPanStateEvent, success: boolean) => void): this;
|
|
185
|
+
onFinalize(callback: (event: CarouselPanStateEvent, success: boolean) => void): this;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export interface CarouselStepOptions {
|
|
189
|
+
count?: number;
|
|
190
|
+
animated?: boolean;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export interface CarouselScrollToOptions {
|
|
194
|
+
index: number;
|
|
195
|
+
animated?: boolean;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export type PaginationProps = PaginationBaseProps &
|
|
199
|
+
(InteractivePaginationProps | DecorativePaginationProps);
|
|
200
|
+
|
|
201
|
+
export interface PaginationDotStyle {
|
|
202
|
+
width?: number;
|
|
203
|
+
height?: number;
|
|
204
|
+
borderRadius?: number;
|
|
205
|
+
borderWidth?: number;
|
|
206
|
+
borderColor?: ColorValue;
|
|
207
|
+
backgroundColor?: ColorValue;
|
|
208
|
+
opacity?: number;
|
|
209
|
+
}
|
package/src/store/index.tsx
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
3
|
import { SharedValue, useSharedValue } from "react-native-reanimated";
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
4
|
+
import type { CarouselCommonVariables } from "../hooks/useCommonVariables";
|
|
5
|
+
import type { InitializedCarouselProps } from "../hooks/useInitProps";
|
|
6
6
|
|
|
7
7
|
type ItemDimensions = Record<number, { width: number; height: number }>;
|
|
8
8
|
|
|
9
|
-
export interface
|
|
10
|
-
props:
|
|
11
|
-
common:
|
|
9
|
+
export interface CarouselContext {
|
|
10
|
+
props: InitializedCarouselProps<unknown>;
|
|
11
|
+
common: CarouselCommonVariables;
|
|
12
12
|
layout: {
|
|
13
13
|
containerSize: SharedValue<{ width: number; height: number }>;
|
|
14
14
|
updateContainerSize: (dimensions: { width: number; height: number }) => void;
|
|
@@ -17,14 +17,14 @@ export interface IContext {
|
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
export const GlobalStateContext = React.createContext<
|
|
20
|
+
export const GlobalStateContext = React.createContext<CarouselContext>({} as CarouselContext);
|
|
21
21
|
|
|
22
22
|
export const GlobalStateProvider = ({
|
|
23
23
|
children,
|
|
24
24
|
value,
|
|
25
25
|
}: {
|
|
26
26
|
children: React.ReactNode;
|
|
27
|
-
value: Pick<
|
|
27
|
+
value: Pick<CarouselContext, "props" | "common">;
|
|
28
28
|
}) => {
|
|
29
29
|
const containerSize = useSharedValue<{ width: number; height: number }>({ width: 0, height: 0 });
|
|
30
30
|
const itemDimensions = useSharedValue<ItemDimensions>({});
|
package/src/types.ts
CHANGED
|
@@ -1,324 +1,32 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
| (T &
|
|
28
|
-
HP & {
|
|
29
|
-
/**
|
|
30
|
-
* Layout items vertically instead of horizontally
|
|
31
|
-
*/
|
|
32
|
-
vertical?: false;
|
|
33
|
-
/**
|
|
34
|
-
* Specified carousel container width.
|
|
35
|
-
* @deprecated Use `style={{ width: ... }}` instead.
|
|
36
|
-
*/
|
|
37
|
-
width?: number;
|
|
38
|
-
/**
|
|
39
|
-
* Specified carousel container height.
|
|
40
|
-
* @deprecated Use `style={{ height: ... }}` instead.
|
|
41
|
-
*/
|
|
42
|
-
height?: number;
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
export interface CustomConfig {
|
|
46
|
-
type?: "negative" | "positive";
|
|
47
|
-
viewCount?: number;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export interface WithSpringAnimation {
|
|
51
|
-
type: "spring";
|
|
52
|
-
config: WithSpringConfig;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export interface WithTimingAnimation {
|
|
56
|
-
type: "timing";
|
|
57
|
-
config: WithTimingConfig;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export type WithAnimation = WithSpringAnimation | WithTimingAnimation;
|
|
61
|
-
|
|
62
|
-
export type TOnProgressChange =
|
|
63
|
-
| ((offsetProgress: number, absoluteProgress: number) => void)
|
|
64
|
-
/**
|
|
65
|
-
* When a SharedValue is provided, the carousel will write `absoluteProgress` into it.
|
|
66
|
-
*/
|
|
67
|
-
| SharedValue<number>;
|
|
68
|
-
|
|
69
|
-
export type TCarouselProps<T = any> = {
|
|
70
|
-
/**
|
|
71
|
-
* @test_coverage ✅ tested in Carousel.test.tsx > should handle the ref props
|
|
72
|
-
*/
|
|
73
|
-
ref?: React.Ref<ICarouselInstance>;
|
|
74
|
-
/**
|
|
75
|
-
* A shared value used internally as the carousel's translation (scroll offset) state.
|
|
76
|
-
*
|
|
77
|
-
* Prefer using `scrollOffsetValue` (same behavior, clearer name). This prop remains
|
|
78
|
-
* for backwards compatibility.
|
|
79
|
-
* @test_coverage ✅ tested in Carousel.test.tsx > should render the correct progress value with the defaultScrollOffsetValue props
|
|
80
|
-
*/
|
|
81
|
-
/**
|
|
82
|
-
* @deprecated Use `scrollOffsetValue` instead.
|
|
83
|
-
*/
|
|
84
|
-
defaultScrollOffsetValue?: SharedValue<number>;
|
|
85
|
-
/**
|
|
86
|
-
* A shared value used internally as the carousel's translation (scroll offset) state.
|
|
87
|
-
*
|
|
88
|
-
* - If provided, the carousel will **mutate** it during gestures/animations.
|
|
89
|
-
* - This is useful when you want to observe the scroll offset outside the carousel.
|
|
90
|
-
*/
|
|
91
|
-
scrollOffsetValue?: SharedValue<number>;
|
|
92
|
-
/**
|
|
93
|
-
* Carousel loop playback.
|
|
94
|
-
* @default true
|
|
95
|
-
* @test_coverage ✅ tested in Carousel.test.tsx > should swipe back to the first item when loop is true
|
|
96
|
-
*/
|
|
97
|
-
loop?: boolean;
|
|
98
|
-
/**
|
|
99
|
-
* Carousel items data set.
|
|
100
|
-
* @test_coverage ✅ tested in Carousel.test.tsx > should render correctly
|
|
101
|
-
*/
|
|
102
|
-
data: T[];
|
|
103
|
-
/**
|
|
104
|
-
* Auto fill data array to allow loop playback when the loop props is true.
|
|
105
|
-
* @default true
|
|
106
|
-
* @example
|
|
107
|
-
* [1] => [1, 1, 1]
|
|
108
|
-
* [1, 2] => [1, 2, 1, 2]
|
|
109
|
-
* @test_coverage ✅ tested in Carousel.test.tsx > should auto fill data array to allow loop playback when the loop props is true
|
|
110
|
-
*/
|
|
111
|
-
autoFillData?: boolean;
|
|
112
|
-
/**
|
|
113
|
-
* Default index
|
|
114
|
-
* @default 0
|
|
115
|
-
* @test_coverage ✅ tested in Carousel.test.tsx > should render the correct item with the defaultIndex props
|
|
116
|
-
*/
|
|
117
|
-
defaultIndex?: number;
|
|
118
|
-
/**
|
|
119
|
-
* Auto play
|
|
120
|
-
* @test_coverage ✅ tested in Carousel.test.tsx > should swipe automatically when autoPlay is true
|
|
121
|
-
*/
|
|
122
|
-
autoPlay?: boolean;
|
|
123
|
-
/**
|
|
124
|
-
* Auto play
|
|
125
|
-
* @description reverse playback
|
|
126
|
-
* @test_coverage ✅ tested in Carousel.test.tsx > should swipe automatically in reverse when autoPlayReverse is true
|
|
127
|
-
*/
|
|
128
|
-
autoPlayReverse?: boolean;
|
|
129
|
-
/**
|
|
130
|
-
* Auto play
|
|
131
|
-
* @description playback interval
|
|
132
|
-
*/
|
|
133
|
-
autoPlayInterval?: number;
|
|
134
|
-
/**
|
|
135
|
-
* Time a scroll animation takes to finish
|
|
136
|
-
* @default 500 (ms)
|
|
137
|
-
*/
|
|
138
|
-
scrollAnimationDuration?: number;
|
|
139
|
-
/**
|
|
140
|
-
* Carousel container style.
|
|
141
|
-
*/
|
|
142
|
-
style?: StyleProp<ViewStyle>;
|
|
143
|
-
/**
|
|
144
|
-
* Carousel content container style.
|
|
145
|
-
*/
|
|
146
|
-
contentContainerStyle?: StyleProp<ViewStyle>;
|
|
147
|
-
/**
|
|
148
|
-
* Horizontal **page size** used for snapping and animations.
|
|
149
|
-
*
|
|
150
|
-
* This is NOT the same as the container width:
|
|
151
|
-
* - **Container size** comes from `style` (recommended) / deprecated `width` / layout measurement.
|
|
152
|
-
* - **Page size** controls snap distance & animation progress per page.
|
|
153
|
-
*
|
|
154
|
-
* Use this when you want multiple items visible in a single viewport (page size < container width).
|
|
155
|
-
* If not provided, the page size falls back to the carousel container width.
|
|
156
|
-
*/
|
|
157
|
-
itemWidth?: number;
|
|
158
|
-
/**
|
|
159
|
-
* Vertical **page size** used for snapping and animations.
|
|
160
|
-
*
|
|
161
|
-
* See `itemWidth` for the container-size vs page-size distinction.
|
|
162
|
-
* If not provided, the page size falls back to the carousel container height.
|
|
163
|
-
*/
|
|
164
|
-
itemHeight?: number;
|
|
165
|
-
|
|
166
|
-
// Other props...
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* @deprecated Previously controlled the outer container width (v4 behaviour).
|
|
170
|
-
* Move this value into `style`, e.g. `style={{ width: 300 }}`.
|
|
171
|
-
*/
|
|
172
|
-
width?: number;
|
|
173
|
-
/**
|
|
174
|
-
* @deprecated Previously controlled the outer container height (v4 behaviour).
|
|
175
|
-
* Move this value into `style`, e.g. `style={{ height: 200 }}`.
|
|
176
|
-
*/
|
|
177
|
-
height?: number;
|
|
178
|
-
/**
|
|
179
|
-
* PanGesture config
|
|
180
|
-
* @test_coverage ✅ tested in Carousel.test.tsx > should call the onConfigurePanGesture callback
|
|
181
|
-
*/
|
|
182
|
-
onConfigurePanGesture?: (panGesture: PanGesture) => void;
|
|
183
|
-
/**
|
|
184
|
-
* Determines the maximum number of items will respond to pan gesture events,
|
|
185
|
-
* windowSize={11} will active visible item plus up to 5 items above and 5 below the viewpor,
|
|
186
|
-
* Reducing this number will reduce the calculation of the animation value and may improve performance.
|
|
187
|
-
* @default 0 all items will respond to pan gesture events.
|
|
188
|
-
*/
|
|
189
|
-
windowSize?: number;
|
|
190
|
-
/**
|
|
191
|
-
* When true, the scroll view stops on multiples of the scroll view's size when scrolling.
|
|
192
|
-
* @default true
|
|
193
|
-
* @test_coverage ✅ tested in Carousel.test.tsx > should swipe to the next item when pagingEnabled is true
|
|
194
|
-
*/
|
|
195
|
-
pagingEnabled?: boolean;
|
|
196
|
-
/**
|
|
197
|
-
* If enabled, releasing the touch will scroll to the nearest item.
|
|
198
|
-
* valid when pagingEnabled=false
|
|
199
|
-
* @default true
|
|
200
|
-
*/
|
|
201
|
-
snapEnabled?: boolean;
|
|
202
|
-
/**
|
|
203
|
-
* If enabled, items will scroll to the first placement when scrolling past the edge rather than closing to the last. (previous conditions: loop=false)
|
|
204
|
-
* @default true
|
|
205
|
-
* @test_coverage ✅ tested in Carousel.test.tsx > should respect overscrollEnabled=false and prevent scrolling beyond bounds
|
|
206
|
-
*/
|
|
207
|
-
overscrollEnabled?: boolean;
|
|
208
|
-
/**
|
|
209
|
-
* If false, Carousel will not respond to any gestures.
|
|
210
|
-
* @default true
|
|
211
|
-
*/
|
|
212
|
-
enabled?: boolean;
|
|
213
|
-
/**
|
|
214
|
-
* Specifies the scrolling animation effect.
|
|
215
|
-
*
|
|
216
|
-
* If provided, it takes precedence over `scrollAnimationDuration`.
|
|
217
|
-
*/
|
|
218
|
-
withAnimation?: WithAnimation;
|
|
219
|
-
/**
|
|
220
|
-
* Used to locate this view in end-to-end tests.
|
|
221
|
-
*/
|
|
222
|
-
testID?: string;
|
|
223
|
-
/**
|
|
224
|
-
* Maximum offset value for once scroll.
|
|
225
|
-
* Carousel cannot scroll over than this value.
|
|
226
|
-
* */
|
|
227
|
-
maxScrollDistancePerSwipe?: number;
|
|
228
|
-
/**
|
|
229
|
-
* Minimum offset value for once scroll.
|
|
230
|
-
* If the translation value is less than this value, the carousel will not scroll.
|
|
231
|
-
* */
|
|
232
|
-
minScrollDistancePerSwipe?: number;
|
|
233
|
-
/**
|
|
234
|
-
* @experimental This API will be changed in the future.
|
|
235
|
-
* If positive, the carousel will scroll to the positive direction and vice versa.
|
|
236
|
-
* @test_coverage ✅ tested in Carousel.test.tsx > should swipe to the correct direction when fixedDirection is positive
|
|
237
|
-
* */
|
|
238
|
-
fixedDirection?: "positive" | "negative";
|
|
239
|
-
/**
|
|
240
|
-
* Custom carousel config.
|
|
241
|
-
*/
|
|
242
|
-
customConfig?: CustomConfig | (() => CustomConfig);
|
|
243
|
-
/**
|
|
244
|
-
* Custom animations.
|
|
245
|
-
* Must be worklet-compatible. See https://docs.swmansion.com/react-native-reanimated/docs/guides/worklets/
|
|
246
|
-
* @test_coverage ✅ tested in Carousel.test.tsx > should apply the custom animation
|
|
247
|
-
*/
|
|
248
|
-
customAnimation?: (value: number, index: number) => ViewStyle;
|
|
249
|
-
/**
|
|
250
|
-
* Render carousel item.
|
|
251
|
-
* @test_coverage ✅ tested in Carousel.test.tsx > should render items correctly
|
|
252
|
-
*/
|
|
253
|
-
renderItem: CarouselRenderItem<T>;
|
|
254
|
-
/**
|
|
255
|
-
* Callback fired when navigating to an item.
|
|
256
|
-
* @test_coverage ✅ tested in Carousel.test.tsx > should call the onSnapToItem callback
|
|
257
|
-
*/
|
|
258
|
-
onSnapToItem?: (index: number) => void;
|
|
259
|
-
/**
|
|
260
|
-
* On scroll start
|
|
261
|
-
* @test_coverage ✅ tested in Carousel.test.tsx > should call the onScrollStart callback
|
|
262
|
-
*/
|
|
263
|
-
onScrollStart?: () => void;
|
|
264
|
-
/**
|
|
265
|
-
* On scroll end
|
|
266
|
-
* @test_coverage ✅ tested in Carousel.test.tsx > should call the onScrollEnd callback
|
|
267
|
-
*/
|
|
268
|
-
onScrollEnd?: (index: number) => void;
|
|
269
|
-
/**
|
|
270
|
-
* On progress change
|
|
271
|
-
* @param offsetProgress Total of offset distance (0 390 780 ...)
|
|
272
|
-
* @param absoluteProgress Convert to index (0 1 2 ...)
|
|
273
|
-
* @test_coverage ✅ tested in Carousel.test.tsx > should call the onProgressChange callback
|
|
274
|
-
*
|
|
275
|
-
* If you want to update a shared value automatically, you can use the shared value as a parameter directly.
|
|
276
|
-
*/
|
|
277
|
-
onProgressChange?: TOnProgressChange;
|
|
278
|
-
onLayout?: (event: LayoutChangeEvent) => void;
|
|
279
|
-
|
|
280
|
-
// ============================== deprecated props ==============================
|
|
281
|
-
/**
|
|
282
|
-
* If enabled, releasing the touch will scroll to the nearest item.
|
|
283
|
-
* valid when pagingEnabled=false
|
|
284
|
-
* @deprecated please use snapEnabled instead
|
|
285
|
-
*/
|
|
286
|
-
enableSnap?: boolean;
|
|
287
|
-
} & (TParallaxModeProps | TStackModeProps);
|
|
288
|
-
|
|
289
|
-
export interface ICarouselInstance {
|
|
290
|
-
/**
|
|
291
|
-
* Scroll to previous item, it takes one optional argument (count),
|
|
292
|
-
* which allows you to specify how many items to cross
|
|
293
|
-
*/
|
|
294
|
-
prev: (opts?: Omit<TCarouselActionOptions, "index">) => void;
|
|
295
|
-
/**
|
|
296
|
-
* Scroll to next item, it takes one optional argument (count),
|
|
297
|
-
* which allows you to specify how many items to cross
|
|
298
|
-
*/
|
|
299
|
-
next: (opts?: Omit<TCarouselActionOptions, "index">) => void;
|
|
300
|
-
/**
|
|
301
|
-
* Get current item index
|
|
302
|
-
*/
|
|
303
|
-
getCurrentIndex: () => number;
|
|
304
|
-
/**
|
|
305
|
-
* Use value to scroll to a position where relative to the current position,
|
|
306
|
-
* scrollTo({count: -2}) is equivalent to prev(2), scrollTo({count: 2}) is equivalent to next(2)
|
|
307
|
-
*/
|
|
308
|
-
scrollTo: (opts?: TCarouselActionOptions) => void;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
export interface CarouselRenderItemInfo<ItemT> {
|
|
312
|
-
item: ItemT;
|
|
313
|
-
index: number;
|
|
314
|
-
animationValue: SharedValue<number>;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
export type CarouselRenderItem<ItemT> = (info: CarouselRenderItemInfo<ItemT>) => React.ReactElement;
|
|
1
|
+
import type { CarouselProps, CarouselScrollToOptions, CarouselStepOptions } from "./public-types";
|
|
2
|
+
|
|
3
|
+
export type {
|
|
4
|
+
CarouselAnimation,
|
|
5
|
+
CarouselItemAnimation,
|
|
6
|
+
CarouselLayout,
|
|
7
|
+
CarouselPanGesture,
|
|
8
|
+
CarouselProgressChangeHandler,
|
|
9
|
+
CarouselProps,
|
|
10
|
+
CarouselRef,
|
|
11
|
+
CarouselRenderItem,
|
|
12
|
+
CarouselRenderItemInfo,
|
|
13
|
+
CarouselScrollToOptions,
|
|
14
|
+
CarouselStepOptions,
|
|
15
|
+
PaginationDotStyle,
|
|
16
|
+
PaginationProps,
|
|
17
|
+
} from "./public-types";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Internal command options retain a completion hook so autoplay can schedule
|
|
21
|
+
* the next dwell period after a transition settles. This is never exported
|
|
22
|
+
* from the package root.
|
|
23
|
+
*/
|
|
24
|
+
export type InternalCarouselStepOptions = CarouselStepOptions & {
|
|
25
|
+
onFinished?: () => void;
|
|
26
|
+
};
|
|
318
27
|
|
|
319
|
-
export
|
|
320
|
-
index?: number;
|
|
321
|
-
count?: number;
|
|
322
|
-
animated?: boolean;
|
|
28
|
+
export type InternalCarouselScrollToOptions = CarouselScrollToOptions & {
|
|
323
29
|
onFinished?: () => void;
|
|
324
|
-
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type InternalCarouselProps<Item> = CarouselProps<Item>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export type CarouselDirectionSign = -1 | 1;
|
|
2
|
+
|
|
3
|
+
export function getCarouselDirectionSign(options: {
|
|
4
|
+
isRTL: boolean;
|
|
5
|
+
orientation: "horizontal" | "vertical";
|
|
6
|
+
}): CarouselDirectionSign {
|
|
7
|
+
"worklet";
|
|
8
|
+
|
|
9
|
+
return options.orientation === "horizontal" && options.isRTL ? -1 : 1;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function toLogicalGestureValue(
|
|
13
|
+
physicalValue: number,
|
|
14
|
+
directionSign: CarouselDirectionSign
|
|
15
|
+
): number {
|
|
16
|
+
"worklet";
|
|
17
|
+
|
|
18
|
+
return physicalValue * directionSign;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function toPhysicalHorizontalValue(
|
|
22
|
+
logicalValue: number,
|
|
23
|
+
directionSign: CarouselDirectionSign
|
|
24
|
+
): number {
|
|
25
|
+
"worklet";
|
|
26
|
+
|
|
27
|
+
return logicalValue * directionSign;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function getHorizontalStackOffsetType(
|
|
31
|
+
exitDirection: "left" | "right",
|
|
32
|
+
directionSign: CarouselDirectionSign
|
|
33
|
+
): "positive" | "negative" {
|
|
34
|
+
"worklet";
|
|
35
|
+
|
|
36
|
+
const ltrType = exitDirection === "right" ? "negative" : "positive";
|
|
37
|
+
if (directionSign === 1) return ltrType;
|
|
38
|
+
return ltrType === "positive" ? "negative" : "positive";
|
|
39
|
+
}
|