react-native-reanimated-carousel 5.0.0-beta.7 → 5.0.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 +60 -28
- 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/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/{components → commonjs/components}/ItemLayout.d.ts +7 -6
- 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 +3 -2
- 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 +2 -2
- 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/{layouts → commonjs/layouts}/normal.d.ts +3 -1
- 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 +161 -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 +161 -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 +34 -7
- package/scripts/codemods/v5.mjs +502 -0
- package/src/components/Carousel.tsx +5 -5
- package/src/components/CarouselLayout.tsx +53 -91
- package/src/components/ItemLayout.tsx +55 -46
- package/src/components/ItemRenderer.tsx +29 -18
- package/src/components/Pagination/PaginationItem.tsx +162 -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 +194 -340
- 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 +3 -3
- package/src/hooks/useOnProgressChange.ts +23 -48
- package/src/hooks/usePanGestureProxy.ts +2 -2
- package/src/hooks/usePropsErrorBoundary.ts +32 -90
- package/src/hooks/useUpdateGestureConfig.ts +5 -2
- package/src/hooks/useVisibleRanges.tsx +2 -2
- 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 +198 -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/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.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.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/Carousel.test.tsx +0 -1215
- package/src/components/LazyView.test.tsx +0 -61
- 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/components/Pagination/Pagination.test.tsx +0 -178
- package/src/components/ScrollViewGesture.test.tsx +0 -155
- package/src/components/issue-899-parallax-reverse-loop.test.tsx +0 -131
- package/src/components/rnr-demo.test.tsx +0 -53
- package/src/hooks/useAutoPlay.test.ts +0 -194
- package/src/hooks/useCarouselController.test.tsx +0 -1158
- package/src/hooks/useCheckMounted.test.ts +0 -47
- package/src/hooks/useCommonVariables.test.tsx +0 -384
- package/src/hooks/useInitProps.test.tsx +0 -134
- package/src/hooks/useLayoutConfig.test.tsx +0 -247
- package/src/hooks/useOffsetX.test.ts +0 -54
- package/src/hooks/useOnProgressChange.test.tsx +0 -270
- package/src/hooks/usePanGestureProxy.test.tsx +0 -368
- package/src/hooks/usePropsErrorBoundary.test.tsx +0 -57
- package/src/hooks/useUpdateGestureConfig.test.ts +0 -89
- package/src/hooks/useVisibleRanges.test.tsx +0 -347
- package/src/layouts/parallax.test.ts +0 -239
- package/src/layouts/stack.test.ts +0 -252
- package/src/store/index.test.tsx +0 -314
- package/src/utils/compute-gesture-translation.test.ts +0 -70
- package/src/utils/compute-offset-if-data-changed.test.ts +0 -133
- package/src/utils/compute-offset-if-data-changed.ts +0 -44
- package/src/utils/compute-offset-if-size-changed.test.ts +0 -78
- package/src/utils/computed-with-auto-fill-data.test.ts +0 -298
- package/src/utils/deal-with-animation.test.ts +0 -181
- package/src/utils/handleroffset-direction.test.ts +0 -124
- package/src/utils/handleroffset-direction.ts +0 -18
- package/src/utils/index.test.ts +0 -90
- package/src/utils/log.test.ts +0 -134
- package/src/utils/sanitize-animation-style.test.ts +0 -40
- /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
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import { withSpring, withTiming } from "react-native-reanimated";
|
|
2
|
-
|
|
3
|
-
import { dealWithAnimation } from "./deal-with-animation";
|
|
4
|
-
|
|
5
|
-
// Mock Reanimated
|
|
6
|
-
jest.mock("react-native-reanimated", () => ({
|
|
7
|
-
withSpring: jest.fn((value, _config, callback) => {
|
|
8
|
-
callback?.(true);
|
|
9
|
-
return value;
|
|
10
|
-
}),
|
|
11
|
-
withTiming: jest.fn((value, _config, callback) => {
|
|
12
|
-
callback?.(true);
|
|
13
|
-
return value;
|
|
14
|
-
}),
|
|
15
|
-
}));
|
|
16
|
-
|
|
17
|
-
describe("dealWithAnimation", () => {
|
|
18
|
-
beforeEach(() => {
|
|
19
|
-
jest.clearAllMocks();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it("should handle spring animation", () => {
|
|
23
|
-
const callback = jest.fn();
|
|
24
|
-
const springConfig = {
|
|
25
|
-
damping: 20,
|
|
26
|
-
stiffness: 90,
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const animation = dealWithAnimation({
|
|
30
|
-
type: "spring",
|
|
31
|
-
config: springConfig,
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
const result = animation(100, callback);
|
|
35
|
-
|
|
36
|
-
expect(withSpring).toHaveBeenCalledWith(100, springConfig, expect.any(Function));
|
|
37
|
-
expect(callback).toHaveBeenCalledWith(true);
|
|
38
|
-
expect(result).toBe(100);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it("should handle timing animation", () => {
|
|
42
|
-
const callback = jest.fn();
|
|
43
|
-
const timingConfig = {
|
|
44
|
-
duration: 300,
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
const animation = dealWithAnimation({
|
|
48
|
-
type: "timing",
|
|
49
|
-
config: timingConfig,
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
const result = animation(100, callback);
|
|
53
|
-
|
|
54
|
-
expect(withTiming).toHaveBeenCalledWith(100, timingConfig, expect.any(Function));
|
|
55
|
-
expect(callback).toHaveBeenCalledWith(true);
|
|
56
|
-
expect(result).toBe(100);
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
it("should pass animation config correctly", () => {
|
|
60
|
-
const springConfig = {
|
|
61
|
-
damping: 10,
|
|
62
|
-
mass: 1,
|
|
63
|
-
stiffness: 100,
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
const animation = dealWithAnimation({
|
|
67
|
-
type: "spring",
|
|
68
|
-
config: springConfig,
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
animation(100, jest.fn());
|
|
72
|
-
|
|
73
|
-
expect(withSpring).toHaveBeenCalledWith(
|
|
74
|
-
100,
|
|
75
|
-
expect.objectContaining(springConfig),
|
|
76
|
-
expect.any(Function)
|
|
77
|
-
);
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
it("should handle animation completion", () => {
|
|
81
|
-
const callback = jest.fn();
|
|
82
|
-
const animation = dealWithAnimation({
|
|
83
|
-
type: "timing",
|
|
84
|
-
config: { duration: 300 },
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
animation(100, callback);
|
|
88
|
-
|
|
89
|
-
expect(callback).toHaveBeenCalledWith(true);
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it("should handle spring animation with different values", () => {
|
|
93
|
-
const callback = jest.fn();
|
|
94
|
-
const animation = dealWithAnimation({
|
|
95
|
-
type: "spring",
|
|
96
|
-
config: { damping: 15 },
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
animation(0, callback);
|
|
100
|
-
animation(-100, callback);
|
|
101
|
-
animation(500, callback);
|
|
102
|
-
|
|
103
|
-
expect(withSpring).toHaveBeenCalledWith(0, { damping: 15 }, expect.any(Function));
|
|
104
|
-
expect(withSpring).toHaveBeenCalledWith(-100, { damping: 15 }, expect.any(Function));
|
|
105
|
-
expect(withSpring).toHaveBeenCalledWith(500, { damping: 15 }, expect.any(Function));
|
|
106
|
-
expect(callback).toHaveBeenCalledTimes(3);
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
it("should handle timing animation with different values", () => {
|
|
110
|
-
const callback = jest.fn();
|
|
111
|
-
const animation = dealWithAnimation({
|
|
112
|
-
type: "timing",
|
|
113
|
-
config: { duration: 500 },
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
animation(0, callback);
|
|
117
|
-
animation(-50, callback);
|
|
118
|
-
animation(1000, callback);
|
|
119
|
-
|
|
120
|
-
expect(withTiming).toHaveBeenCalledWith(0, { duration: 500 }, expect.any(Function));
|
|
121
|
-
expect(withTiming).toHaveBeenCalledWith(-50, { duration: 500 }, expect.any(Function));
|
|
122
|
-
expect(withTiming).toHaveBeenCalledWith(1000, { duration: 500 }, expect.any(Function));
|
|
123
|
-
expect(callback).toHaveBeenCalledTimes(3);
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
it("should handle empty spring config", () => {
|
|
127
|
-
const callback = jest.fn();
|
|
128
|
-
const animation = dealWithAnimation({
|
|
129
|
-
type: "spring",
|
|
130
|
-
config: {},
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
animation(100, callback);
|
|
134
|
-
|
|
135
|
-
expect(withSpring).toHaveBeenCalledWith(100, {}, expect.any(Function));
|
|
136
|
-
expect(callback).toHaveBeenCalledWith(true);
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
it("should handle empty timing config", () => {
|
|
140
|
-
const callback = jest.fn();
|
|
141
|
-
const animation = dealWithAnimation({
|
|
142
|
-
type: "timing",
|
|
143
|
-
config: {},
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
animation(100, callback);
|
|
147
|
-
|
|
148
|
-
expect(withTiming).toHaveBeenCalledWith(100, {}, expect.any(Function));
|
|
149
|
-
expect(callback).toHaveBeenCalledWith(true);
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
it("should handle fractional values", () => {
|
|
153
|
-
const callback = jest.fn();
|
|
154
|
-
const animation = dealWithAnimation({
|
|
155
|
-
type: "spring",
|
|
156
|
-
config: { damping: 10 },
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
animation(50.5, callback);
|
|
160
|
-
animation(-25.75, callback);
|
|
161
|
-
|
|
162
|
-
expect(withSpring).toHaveBeenCalledWith(50.5, { damping: 10 }, expect.any(Function));
|
|
163
|
-
expect(withSpring).toHaveBeenCalledWith(-25.75, { damping: 10 }, expect.any(Function));
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
it("should create different animation functions for different configs", () => {
|
|
167
|
-
const animation1 = dealWithAnimation({
|
|
168
|
-
type: "spring",
|
|
169
|
-
config: { damping: 10 },
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
const animation2 = dealWithAnimation({
|
|
173
|
-
type: "timing",
|
|
174
|
-
config: { duration: 200 },
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
expect(animation1).not.toBe(animation2);
|
|
178
|
-
expect(typeof animation1).toBe("function");
|
|
179
|
-
expect(typeof animation2).toBe("function");
|
|
180
|
-
});
|
|
181
|
-
});
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { useSharedValue } from "react-native-reanimated";
|
|
2
|
-
|
|
3
|
-
import { renderHook } from "@testing-library/react-hooks";
|
|
4
|
-
|
|
5
|
-
import { handlerOffsetDirection } from "./handleroffset-direction";
|
|
6
|
-
|
|
7
|
-
describe("handlerOffsetDirection", () => {
|
|
8
|
-
it("should return -1 when default value equals to zero", () => {
|
|
9
|
-
const result = renderHook(() => {
|
|
10
|
-
const handlerOffsetAnimVal = useSharedValue(0);
|
|
11
|
-
return handlerOffsetDirection(handlerOffsetAnimVal);
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
expect(result.result.current).toBe(-1);
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
it("should return 1 when default value is greater than zero", () => {
|
|
18
|
-
const result = renderHook(() => {
|
|
19
|
-
const handlerOffsetAnimVal = useSharedValue(1);
|
|
20
|
-
return handlerOffsetDirection(handlerOffsetAnimVal);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
expect(result.result.current).toBe(1);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it("should return -1 when default value is less than zero", () => {
|
|
27
|
-
const result = renderHook(() => {
|
|
28
|
-
const handlerOffsetAnimVal = useSharedValue(-1);
|
|
29
|
-
return handlerOffsetDirection(handlerOffsetAnimVal);
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
expect(result.result.current).toBe(-1);
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it("should return 1 when default value equals to zero and fixedDirection is negative", () => {
|
|
36
|
-
const result = renderHook(() => {
|
|
37
|
-
const handlerOffsetAnimVal = useSharedValue(-1);
|
|
38
|
-
return handlerOffsetDirection(handlerOffsetAnimVal, "positive");
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
expect(result.result.current).toBe(1);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it("should return -1 when default value is greater than zero and fixedDirection is negative", () => {
|
|
45
|
-
const result = renderHook(() => {
|
|
46
|
-
const handlerOffsetAnimVal = useSharedValue(1);
|
|
47
|
-
return handlerOffsetDirection(handlerOffsetAnimVal, "negative");
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
expect(result.result.current).toBe(-1);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it("should handle fractional positive values", () => {
|
|
54
|
-
const result = renderHook(() => {
|
|
55
|
-
const handlerOffsetAnimVal = useSharedValue(0.5);
|
|
56
|
-
return handlerOffsetDirection(handlerOffsetAnimVal);
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
expect(result.result.current).toBe(1);
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it("should handle fractional negative values", () => {
|
|
63
|
-
const result = renderHook(() => {
|
|
64
|
-
const handlerOffsetAnimVal = useSharedValue(-0.5);
|
|
65
|
-
return handlerOffsetDirection(handlerOffsetAnimVal);
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
expect(result.result.current).toBe(-1);
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
it("should handle large positive values", () => {
|
|
72
|
-
const result = renderHook(() => {
|
|
73
|
-
const handlerOffsetAnimVal = useSharedValue(1000);
|
|
74
|
-
return handlerOffsetDirection(handlerOffsetAnimVal);
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
expect(result.result.current).toBe(1);
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
it("should handle large negative values", () => {
|
|
81
|
-
const result = renderHook(() => {
|
|
82
|
-
const handlerOffsetAnimVal = useSharedValue(-1000);
|
|
83
|
-
return handlerOffsetDirection(handlerOffsetAnimVal);
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
expect(result.result.current).toBe(-1);
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
it("should override with positive fixed direction", () => {
|
|
90
|
-
const result = renderHook(() => {
|
|
91
|
-
const handlerOffsetAnimVal = useSharedValue(-100);
|
|
92
|
-
return handlerOffsetDirection(handlerOffsetAnimVal, "positive");
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
expect(result.result.current).toBe(1);
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
it("should override with negative fixed direction", () => {
|
|
99
|
-
const result = renderHook(() => {
|
|
100
|
-
const handlerOffsetAnimVal = useSharedValue(100);
|
|
101
|
-
return handlerOffsetDirection(handlerOffsetAnimVal, "negative");
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
expect(result.result.current).toBe(-1);
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
it("should handle very small positive values", () => {
|
|
108
|
-
const result = renderHook(() => {
|
|
109
|
-
const handlerOffsetAnimVal = useSharedValue(0.001);
|
|
110
|
-
return handlerOffsetDirection(handlerOffsetAnimVal);
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
expect(result.result.current).toBe(1);
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
it("should handle very small negative values", () => {
|
|
117
|
-
const result = renderHook(() => {
|
|
118
|
-
const handlerOffsetAnimVal = useSharedValue(-0.001);
|
|
119
|
-
return handlerOffsetDirection(handlerOffsetAnimVal);
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
expect(result.result.current).toBe(-1);
|
|
123
|
-
});
|
|
124
|
-
});
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { SharedValue } from "react-native-reanimated";
|
|
2
|
-
|
|
3
|
-
import type { TCarouselProps } from "../types";
|
|
4
|
-
|
|
5
|
-
export function handlerOffsetDirection(
|
|
6
|
-
handlerOffset: SharedValue<number>,
|
|
7
|
-
fixedDirection?: TCarouselProps["fixedDirection"]
|
|
8
|
-
): -1 | 1 {
|
|
9
|
-
"worklet";
|
|
10
|
-
|
|
11
|
-
if (fixedDirection === "negative") return -1;
|
|
12
|
-
|
|
13
|
-
if (fixedDirection === "positive") return 1;
|
|
14
|
-
|
|
15
|
-
if (handlerOffset.value === 0) return -1;
|
|
16
|
-
|
|
17
|
-
return Math.sign(handlerOffset.value) as -1 | 1;
|
|
18
|
-
}
|
package/src/utils/index.test.ts
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { computeOffsetIfDataChanged } from "./compute-offset-if-data-changed";
|
|
2
|
-
|
|
3
|
-
describe("should work as expected", () => {
|
|
4
|
-
const size = 375;
|
|
5
|
-
const positive = -1;
|
|
6
|
-
const negative = 1;
|
|
7
|
-
|
|
8
|
-
const params = (params: {
|
|
9
|
-
direction: "positive" | "negative";
|
|
10
|
-
currentIndex: number;
|
|
11
|
-
previousLength: number;
|
|
12
|
-
currentLength: number;
|
|
13
|
-
}) => {
|
|
14
|
-
const { currentIndex, direction: _direction, previousLength, currentLength } = params;
|
|
15
|
-
const direction = _direction === "negative" ? negative : positive;
|
|
16
|
-
return {
|
|
17
|
-
direction,
|
|
18
|
-
handlerOffset: size * currentIndex * direction,
|
|
19
|
-
size,
|
|
20
|
-
previousLength,
|
|
21
|
-
currentLength,
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
it("The direction is negative, And changing length of data set from 4 to 3, the new index will to be 2.", async () => {
|
|
26
|
-
const currentIndex = 1;
|
|
27
|
-
const handlerOffset = computeOffsetIfDataChanged(
|
|
28
|
-
params({
|
|
29
|
-
currentIndex,
|
|
30
|
-
direction: "negative",
|
|
31
|
-
previousLength: 4,
|
|
32
|
-
currentLength: 3,
|
|
33
|
-
})
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
expect(handlerOffset / size).toBe(2 * positive);
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it("The direction is negative, Changing length of data set from 4 to 3, the index remains original.", async () => {
|
|
40
|
-
const handlerOffset = computeOffsetIfDataChanged(
|
|
41
|
-
params({
|
|
42
|
-
currentIndex: 2,
|
|
43
|
-
direction: "negative",
|
|
44
|
-
previousLength: 4,
|
|
45
|
-
currentLength: 3,
|
|
46
|
-
})
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
expect(handlerOffset / size).toBe(1 * negative);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it("The direction is positive, Changing length of data set from 4 to 5, the index remains original.", async () => {
|
|
53
|
-
const handlerOffset = computeOffsetIfDataChanged(
|
|
54
|
-
params({
|
|
55
|
-
currentIndex: 3,
|
|
56
|
-
direction: "positive",
|
|
57
|
-
previousLength: 4,
|
|
58
|
-
currentLength: 5,
|
|
59
|
-
})
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
expect(handlerOffset / size).toBe(3 * positive);
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it("The direction is negative, Changing length of data set from 4 to 5, the index remains original.", async () => {
|
|
66
|
-
const handlerOffset = computeOffsetIfDataChanged(
|
|
67
|
-
params({
|
|
68
|
-
currentIndex: 3,
|
|
69
|
-
direction: "negative",
|
|
70
|
-
previousLength: 4,
|
|
71
|
-
currentLength: 5,
|
|
72
|
-
})
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
expect(handlerOffset / size).toBe(4 * negative);
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
it("Changing length of data set from 0 to 3, the index remains original.", async () => {
|
|
79
|
-
const handlerOffset = computeOffsetIfDataChanged(
|
|
80
|
-
params({
|
|
81
|
-
currentIndex: 0,
|
|
82
|
-
direction: "positive",
|
|
83
|
-
previousLength: 0,
|
|
84
|
-
currentLength: 3,
|
|
85
|
-
})
|
|
86
|
-
);
|
|
87
|
-
|
|
88
|
-
expect(handlerOffset / size).toBe(0 * positive);
|
|
89
|
-
});
|
|
90
|
-
});
|
package/src/utils/log.test.ts
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import { log, round } from "./log";
|
|
2
|
-
|
|
3
|
-
describe("log utilities", () => {
|
|
4
|
-
describe("log", () => {
|
|
5
|
-
const mockConsoleLog = jest.fn();
|
|
6
|
-
const originalConsoleLog = console.log;
|
|
7
|
-
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
console.log = mockConsoleLog;
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
afterEach(() => {
|
|
13
|
-
mockConsoleLog.mockClear();
|
|
14
|
-
console.log = originalConsoleLog;
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
it("should call console.log with provided arguments", () => {
|
|
18
|
-
const args = ["test", 123, { key: "value" }];
|
|
19
|
-
log(...args);
|
|
20
|
-
|
|
21
|
-
expect(mockConsoleLog).toHaveBeenCalledWith(...args);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it("should handle single argument", () => {
|
|
25
|
-
log("test");
|
|
26
|
-
expect(mockConsoleLog).toHaveBeenCalledWith("test");
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it("should handle multiple arguments", () => {
|
|
30
|
-
log("test", 123, true);
|
|
31
|
-
expect(mockConsoleLog).toHaveBeenCalledWith("test", 123, true);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it("should handle no arguments", () => {
|
|
35
|
-
log();
|
|
36
|
-
expect(mockConsoleLog).toHaveBeenCalledWith();
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it("should handle null and undefined", () => {
|
|
40
|
-
log(null, undefined);
|
|
41
|
-
expect(mockConsoleLog).toHaveBeenCalledWith(null, undefined);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it("should handle complex objects", () => {
|
|
45
|
-
const complexObj = {
|
|
46
|
-
nested: { array: [1, 2, 3] },
|
|
47
|
-
func: () => "test",
|
|
48
|
-
date: new Date("2023-01-01"),
|
|
49
|
-
};
|
|
50
|
-
log(complexObj);
|
|
51
|
-
expect(mockConsoleLog).toHaveBeenCalledWith(complexObj);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it("should handle arrays", () => {
|
|
55
|
-
const arr = [1, "two", { three: 3 }];
|
|
56
|
-
log(arr);
|
|
57
|
-
expect(mockConsoleLog).toHaveBeenCalledWith(arr);
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
it("should handle mixed types", () => {
|
|
61
|
-
log("string", 42, true, null, undefined, { key: "value" }, [1, 2, 3]);
|
|
62
|
-
expect(mockConsoleLog).toHaveBeenCalledWith(
|
|
63
|
-
"string",
|
|
64
|
-
42,
|
|
65
|
-
true,
|
|
66
|
-
null,
|
|
67
|
-
undefined,
|
|
68
|
-
{ key: "value" },
|
|
69
|
-
[1, 2, 3]
|
|
70
|
-
);
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
describe("round", () => {
|
|
75
|
-
it("should round positive numbers correctly", () => {
|
|
76
|
-
expect(round(1.4)).toBe(1);
|
|
77
|
-
expect(round(1.5)).toBe(2);
|
|
78
|
-
expect(round(1.6)).toBe(2);
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
it("should round negative numbers correctly", () => {
|
|
82
|
-
expect(round(-1.4)).toBe(-1);
|
|
83
|
-
expect(round(-1.5)).toBe(-1);
|
|
84
|
-
expect(round(-1.6)).toBe(-2);
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
it("should handle zero values", () => {
|
|
88
|
-
expect(round(0)).toBe(0);
|
|
89
|
-
expect(round(-0)).toBe(-0);
|
|
90
|
-
expect(1 / round(-0)).toBe(Number.NEGATIVE_INFINITY);
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it("should handle integers", () => {
|
|
94
|
-
expect(round(5)).toBe(5);
|
|
95
|
-
expect(round(-5)).toBe(-5);
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
it("should handle decimal places", () => {
|
|
99
|
-
expect(round(Math.PI)).toBe(3);
|
|
100
|
-
expect(round(-Math.PI)).toBe(-3);
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
it("should handle edge cases", () => {
|
|
104
|
-
expect(round(0.5)).toBe(1);
|
|
105
|
-
expect(round(-0.5)).toBe(-0);
|
|
106
|
-
expect(round(1.999999)).toBe(2);
|
|
107
|
-
expect(round(-1.999999)).toBe(-2);
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
it("should handle very large numbers", () => {
|
|
111
|
-
expect(round(1e10 + 0.4)).toBe(1e10);
|
|
112
|
-
expect(round(1e10 + 0.6)).toBe(1e10 + 1);
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
it("should handle very small numbers", () => {
|
|
116
|
-
expect(round(0.00001)).toBe(0);
|
|
117
|
-
expect(round(-0.00001)).toBe(-0);
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
it("should handle Infinity", () => {
|
|
121
|
-
expect(round(Number.POSITIVE_INFINITY)).toBe(Number.POSITIVE_INFINITY);
|
|
122
|
-
expect(round(Number.NEGATIVE_INFINITY)).toBe(Number.NEGATIVE_INFINITY);
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
it("should handle NaN", () => {
|
|
126
|
-
expect(round(Number.NaN)).toBe(Number.NaN);
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
it("should handle floating point precision issues", () => {
|
|
130
|
-
expect(round(0.1 + 0.2)).toBe(0); // 0.1 + 0.2 = 0.30000000000000004
|
|
131
|
-
expect(round(1.1 + 1.2)).toBe(2); // Should round to 2
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
});
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { sanitizeAnimationStyle } from "./sanitize-animation-style";
|
|
2
|
-
|
|
3
|
-
describe("sanitizeAnimationStyle", () => {
|
|
4
|
-
it("rounds zIndex to an integer", () => {
|
|
5
|
-
const style = sanitizeAnimationStyle({
|
|
6
|
-
transform: [{ translateX: 12 }],
|
|
7
|
-
zIndex: 3.7,
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
expect(style.zIndex).toBe(4);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it("drops invalid zIndex values", () => {
|
|
14
|
-
const style = sanitizeAnimationStyle({
|
|
15
|
-
// invalid value from userland worklet should not flow to native styles
|
|
16
|
-
zIndex: Number.NaN,
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
expect(style).not.toHaveProperty("zIndex");
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it("returns empty object for null/undefined input", () => {
|
|
23
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
24
|
-
expect(sanitizeAnimationStyle(null as any)).toEqual({});
|
|
25
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
|
-
expect(sanitizeAnimationStyle(undefined as any)).toEqual({});
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it("strips non-number zIndex (e.g. string)", () => {
|
|
30
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
31
|
-
const style = sanitizeAnimationStyle({ opacity: 1, zIndex: "auto" as any });
|
|
32
|
-
expect(style).not.toHaveProperty("zIndex");
|
|
33
|
-
expect(style).toHaveProperty("opacity", 1);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it("preserves style without zIndex unchanged", () => {
|
|
37
|
-
const style = sanitizeAnimationStyle({ opacity: 0.5 });
|
|
38
|
-
expect(style).toEqual({ opacity: 0.5 });
|
|
39
|
-
});
|
|
40
|
-
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|