@fountain-ui/lab 2.0.0-beta.5 → 2.0.0-beta.50
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/build/commonjs/AnimatedY/AnimatedY.js +10 -14
- package/build/commonjs/AnimatedY/AnimatedY.js.map +1 -1
- package/build/commonjs/AnimatedY/AnimatedYProps.js.map +1 -1
- package/build/commonjs/AnimatedY/index.js.map +1 -1
- package/build/commonjs/BottomSheet/BottomSheetNative.js +28 -5
- package/build/commonjs/BottomSheet/BottomSheetNative.js.map +1 -1
- package/build/commonjs/BottomSheet/BottomSheetProps.js.map +1 -1
- package/build/commonjs/BottomSheet/BottomSheetWeb.js +26 -15
- package/build/commonjs/BottomSheet/BottomSheetWeb.js.map +1 -1
- package/build/commonjs/BottomSheet/TransparentBackdrop.js +1 -1
- package/build/commonjs/BottomSheet/TransparentBackdrop.js.map +1 -1
- package/build/commonjs/BottomSheet/index.js.map +1 -1
- package/build/commonjs/BottomSheet/index.native.js.map +1 -1
- package/build/commonjs/BottomSheet/useDynamicSnapPoints.js +65 -0
- package/build/commonjs/BottomSheet/useDynamicSnapPoints.js.map +1 -0
- package/build/commonjs/Carousel/Carousel.js +130 -0
- package/build/commonjs/Carousel/Carousel.js.map +1 -0
- package/build/commonjs/Carousel/CarouselProps.js.map +1 -1
- package/build/commonjs/Carousel/animation/animationUtils.js +9 -0
- package/build/commonjs/Carousel/animation/animationUtils.js.map +1 -0
- package/build/commonjs/Carousel/animation/createDefaultItemStyle.js +15 -0
- package/build/commonjs/Carousel/animation/createDefaultItemStyle.js.map +1 -0
- package/build/commonjs/Carousel/animation/createDefaultScrollAnimation.js +20 -0
- package/build/commonjs/Carousel/animation/createDefaultScrollAnimation.js.map +1 -0
- package/build/commonjs/Carousel/animation/index.js +40 -0
- package/build/commonjs/Carousel/animation/index.js.map +1 -0
- package/build/commonjs/Carousel/animation/normalItemStyleFactory.js +27 -0
- package/build/commonjs/Carousel/animation/normalItemStyleFactory.js.map +1 -0
- package/build/commonjs/Carousel/animation/parallaxItemStyleFactory.js +65 -0
- package/build/commonjs/Carousel/animation/parallaxItemStyleFactory.js.map +1 -0
- package/build/commonjs/Carousel/components/InternalContext.js +29 -0
- package/build/commonjs/Carousel/components/InternalContext.js.map +1 -0
- package/build/commonjs/Carousel/components/ItemView.js +66 -0
- package/build/commonjs/Carousel/components/ItemView.js.map +1 -0
- package/build/commonjs/Carousel/components/RootView.js +86 -0
- package/build/commonjs/Carousel/components/RootView.js.map +1 -0
- package/build/commonjs/Carousel/components/ScrollViewGesture.js +82 -0
- package/build/commonjs/Carousel/components/ScrollViewGesture.js.map +1 -0
- package/build/commonjs/Carousel/components/index.js +40 -0
- package/build/commonjs/Carousel/components/index.js.map +1 -0
- package/build/commonjs/Carousel/components/useItemInterpolation.js +65 -0
- package/build/commonjs/Carousel/components/useItemInterpolation.js.map +1 -0
- package/build/commonjs/Carousel/hooks/index.js +48 -0
- package/build/commonjs/Carousel/hooks/index.js.map +1 -0
- package/build/commonjs/Carousel/hooks/useAutoplayController.js +58 -0
- package/build/commonjs/Carousel/hooks/useAutoplayController.js.map +1 -0
- package/build/commonjs/Carousel/hooks/useIndexController.js +55 -0
- package/build/commonjs/Carousel/hooks/useIndexController.js.map +1 -0
- package/build/commonjs/Carousel/hooks/useItemVisibilityStore.js +95 -0
- package/build/commonjs/Carousel/hooks/useItemVisibilityStore.js.map +1 -0
- package/build/commonjs/Carousel/hooks/useLoopedData.js +33 -0
- package/build/commonjs/Carousel/hooks/useLoopedData.js.map +1 -0
- package/build/commonjs/Carousel/hooks/usePagingAnimator.js +202 -0
- package/build/commonjs/Carousel/hooks/usePagingAnimator.js.map +1 -0
- package/build/commonjs/Carousel/index.js +16 -2
- package/build/commonjs/Carousel/index.js.map +1 -1
- package/build/commonjs/Carousel/tick.js +16 -0
- package/build/commonjs/Carousel/tick.js.map +1 -0
- package/build/commonjs/Carousel/types.js +8 -0
- package/build/commonjs/Carousel/types.js.map +1 -0
- package/build/commonjs/ComicViewer/ComicViewer.js +248 -88
- package/build/commonjs/ComicViewer/ComicViewer.js.map +1 -1
- package/build/commonjs/ComicViewer/ComicViewerProps.js.map +1 -1
- package/build/commonjs/ComicViewer/EncodedTile.js +10 -0
- package/build/commonjs/ComicViewer/EncodedTile.js.map +1 -0
- package/build/commonjs/ComicViewer/FastScroll.js +162 -0
- package/build/commonjs/ComicViewer/FastScroll.js.map +1 -0
- package/build/commonjs/ComicViewer/{ComicViewerItemProps.js → FastScrollProps.js} +1 -1
- package/build/commonjs/ComicViewer/FastScrollProps.js.map +1 -0
- package/build/commonjs/ComicViewer/ReloadButton.js +48 -0
- package/build/commonjs/ComicViewer/ReloadButton.js.map +1 -0
- package/build/commonjs/ComicViewer/ViewerItem.js +51 -58
- package/build/commonjs/ComicViewer/ViewerItem.js.map +1 -1
- package/build/commonjs/ComicViewer/index.js.map +1 -1
- package/build/commonjs/ComicViewer/util.js +27 -0
- package/build/commonjs/ComicViewer/util.js.map +1 -0
- package/build/commonjs/DateTimePicker/DateTimePicker.js.map +1 -1
- package/build/commonjs/DateTimePicker/DateTimePickerProps.js.map +1 -1
- package/build/commonjs/DateTimePicker/DateTimePickerProvider.js.map +1 -1
- package/build/commonjs/DateTimePicker/YearPicker.js +21 -17
- package/build/commonjs/DateTimePicker/YearPicker.js.map +1 -1
- package/build/commonjs/DateTimePicker/index.js +4 -4
- package/build/commonjs/DateTimePicker/index.js.map +1 -1
- package/build/commonjs/DateTimePicker/utils.js +2 -1
- package/build/commonjs/DateTimePicker/utils.js.map +1 -1
- package/build/commonjs/FlipCard/FlipCard.js +7 -13
- package/build/commonjs/FlipCard/FlipCard.js.map +1 -1
- package/build/commonjs/FlipCard/FlipCardProps.js.map +1 -1
- package/build/commonjs/FlipCard/index.js.map +1 -1
- package/build/commonjs/StatusBarProvider/Provider.js +1 -1
- package/build/commonjs/StatusBarProvider/Provider.js.map +1 -1
- package/build/commonjs/StatusBarProvider/StatusBarProvider.js.map +1 -1
- package/build/commonjs/StatusBarProvider/StatusBarProviderProps.js.map +1 -1
- package/build/commonjs/StatusBarProvider/index.js.map +1 -1
- package/build/commonjs/ViewPager/FluxContext.js +13 -0
- package/build/commonjs/ViewPager/FluxContext.js.map +1 -0
- package/build/commonjs/ViewPager/InternalContext.js +17 -0
- package/build/commonjs/ViewPager/InternalContext.js.map +1 -0
- package/build/commonjs/ViewPager/PageStateContext.js +16 -0
- package/build/commonjs/ViewPager/PageStateContext.js.map +1 -0
- package/build/commonjs/ViewPager/ViewPager.js +81 -0
- package/build/commonjs/ViewPager/ViewPager.js.map +1 -0
- package/build/commonjs/ViewPager/ViewPager.native.js +150 -0
- package/build/commonjs/ViewPager/ViewPager.native.js.map +1 -0
- package/build/commonjs/ViewPager/ViewPagerProps.js.map +1 -1
- package/build/commonjs/ViewPager/components/ChildrenMemoizedPage.js +122 -0
- package/build/commonjs/ViewPager/components/ChildrenMemoizedPage.js.map +1 -0
- package/build/commonjs/ViewPager/components/FluxStoreProvider.js +37 -0
- package/build/commonjs/ViewPager/components/FluxStoreProvider.js.map +1 -0
- package/build/commonjs/ViewPager/components/index.js +24 -0
- package/build/commonjs/ViewPager/components/index.js.map +1 -0
- package/build/commonjs/ViewPager/hooks/index.js +64 -0
- package/build/commonjs/ViewPager/hooks/index.js.map +1 -0
- package/build/commonjs/ViewPager/hooks/useDispatch.js +22 -0
- package/build/commonjs/ViewPager/hooks/useDispatch.js.map +1 -0
- package/build/commonjs/ViewPager/hooks/useEagerState.js +24 -0
- package/build/commonjs/ViewPager/hooks/useEagerState.js.map +1 -0
- package/build/commonjs/ViewPager/hooks/useForceRender.js +16 -0
- package/build/commonjs/ViewPager/hooks/useForceRender.js.map +1 -0
- package/build/commonjs/ViewPager/hooks/useLazyState.js +45 -0
- package/build/commonjs/ViewPager/hooks/useLazyState.js.map +1 -0
- package/build/commonjs/ViewPager/hooks/usePageStore.js +35 -0
- package/build/commonjs/ViewPager/hooks/usePageStore.js.map +1 -0
- package/build/commonjs/ViewPager/hooks/useStore.js +26 -0
- package/build/commonjs/ViewPager/hooks/useStore.js.map +1 -0
- package/build/commonjs/ViewPager/hooks/useViewPagerPageState.js +19 -0
- package/build/commonjs/ViewPager/hooks/useViewPagerPageState.js.map +1 -0
- package/build/commonjs/ViewPager/index.js +42 -2
- package/build/commonjs/ViewPager/index.js.map +1 -1
- package/build/commonjs/ViewPager/types.js +2 -0
- package/build/commonjs/ViewPager/types.js.map +1 -0
- package/build/commonjs/ViewPager/utils.js +12 -43
- package/build/commonjs/ViewPager/utils.js.map +1 -1
- package/build/commonjs/ViewabilityTrackerView/Viewability.js +2 -0
- package/build/commonjs/ViewabilityTrackerView/Viewability.js.map +1 -0
- package/build/commonjs/ViewabilityTrackerView/ViewabilityTrackerView.js +45 -0
- package/build/commonjs/ViewabilityTrackerView/ViewabilityTrackerView.js.map +1 -0
- package/build/commonjs/ViewabilityTrackerView/ViewabilityTrackerViewProps.js +2 -0
- package/build/commonjs/ViewabilityTrackerView/ViewabilityTrackerViewProps.js.map +1 -0
- package/build/commonjs/{Carousel/index.native.js → ViewabilityTrackerView/index.js} +3 -3
- package/build/commonjs/ViewabilityTrackerView/index.js.map +1 -0
- package/build/commonjs/ViewabilityTrackerView/measureViewability.js +42 -0
- package/build/commonjs/ViewabilityTrackerView/measureViewability.js.map +1 -0
- package/build/commonjs/ViewabilityTrackerView/useViewabilityTracker.js +88 -0
- package/build/commonjs/ViewabilityTrackerView/useViewabilityTracker.js.map +1 -0
- package/build/commonjs/hooks/index.js +16 -0
- package/build/commonjs/hooks/index.js.map +1 -1
- package/build/commonjs/hooks/useAppbarStyles.js.map +1 -1
- package/build/commonjs/hooks/useDeferredExecutor.js +45 -0
- package/build/commonjs/hooks/useDeferredExecutor.js.map +1 -0
- package/build/commonjs/hooks/useElevationStyle.js.map +1 -1
- package/build/commonjs/hooks/useHeight.js +7 -6
- package/build/commonjs/hooks/useHeight.js.map +1 -1
- package/build/commonjs/hooks/useIsMounted.js +22 -0
- package/build/commonjs/hooks/useIsMounted.js.map +1 -0
- package/build/commonjs/hooks/useUnstableCollapsibleAppBar.js +58 -61
- package/build/commonjs/hooks/useUnstableCollapsibleAppBar.js.map +1 -1
- package/build/commonjs/hooks/useUnstableToggleDisplayStyle.js +9 -11
- package/build/commonjs/hooks/useUnstableToggleDisplayStyle.js.map +1 -1
- package/build/commonjs/index.js +28 -7
- package/build/commonjs/index.js.map +1 -1
- package/build/module/AnimatedY/AnimatedY.js +11 -10
- package/build/module/AnimatedY/AnimatedY.js.map +1 -1
- package/build/module/AnimatedY/AnimatedYProps.js.map +1 -1
- package/build/module/AnimatedY/index.js.map +1 -1
- package/build/module/BottomSheet/BottomSheetNative.js +29 -7
- package/build/module/BottomSheet/BottomSheetNative.js.map +1 -1
- package/build/module/BottomSheet/BottomSheetProps.js.map +1 -1
- package/build/module/BottomSheet/BottomSheetWeb.js +24 -15
- package/build/module/BottomSheet/BottomSheetWeb.js.map +1 -1
- package/build/module/BottomSheet/TransparentBackdrop.js +1 -1
- package/build/module/BottomSheet/TransparentBackdrop.js.map +1 -1
- package/build/module/BottomSheet/index.js.map +1 -1
- package/build/module/BottomSheet/index.native.js.map +1 -1
- package/build/module/BottomSheet/useDynamicSnapPoints.js +52 -0
- package/build/module/BottomSheet/useDynamicSnapPoints.js.map +1 -0
- package/build/module/Carousel/Carousel.js +109 -0
- package/build/module/Carousel/Carousel.js.map +1 -0
- package/build/module/Carousel/CarouselProps.js.map +1 -1
- package/build/module/Carousel/animation/animationUtils.js +2 -0
- package/build/module/Carousel/animation/animationUtils.js.map +1 -0
- package/build/module/Carousel/animation/createDefaultItemStyle.js +3 -0
- package/build/module/Carousel/animation/createDefaultItemStyle.js.map +1 -0
- package/build/module/Carousel/animation/createDefaultScrollAnimation.js +11 -0
- package/build/module/Carousel/animation/createDefaultScrollAnimation.js.map +1 -0
- package/build/module/Carousel/animation/index.js +5 -0
- package/build/module/Carousel/animation/index.js.map +1 -0
- package/build/module/Carousel/animation/normalItemStyleFactory.js +18 -0
- package/build/module/Carousel/animation/normalItemStyleFactory.js.map +1 -0
- package/build/module/Carousel/animation/parallaxItemStyleFactory.js +55 -0
- package/build/module/Carousel/animation/parallaxItemStyleFactory.js.map +1 -0
- package/build/module/Carousel/components/InternalContext.js +19 -0
- package/build/module/Carousel/components/InternalContext.js.map +1 -0
- package/build/module/Carousel/components/ItemView.js +46 -0
- package/build/module/Carousel/components/ItemView.js.map +1 -0
- package/build/module/Carousel/components/RootView.js +65 -0
- package/build/module/Carousel/components/RootView.js.map +1 -0
- package/build/module/Carousel/components/ScrollViewGesture.js +68 -0
- package/build/module/Carousel/components/ScrollViewGesture.js.map +1 -0
- package/build/module/Carousel/components/index.js +5 -0
- package/build/module/Carousel/components/index.js.map +1 -0
- package/build/module/Carousel/components/useItemInterpolation.js +51 -0
- package/build/module/Carousel/components/useItemInterpolation.js.map +1 -0
- package/build/module/Carousel/hooks/index.js +6 -0
- package/build/module/Carousel/hooks/index.js.map +1 -0
- package/build/module/Carousel/hooks/useAutoplayController.js +48 -0
- package/build/module/Carousel/hooks/useAutoplayController.js.map +1 -0
- package/build/module/Carousel/hooks/useIndexController.js +44 -0
- package/build/module/Carousel/hooks/useIndexController.js.map +1 -0
- package/build/module/Carousel/hooks/useItemVisibilityStore.js +86 -0
- package/build/module/Carousel/hooks/useItemVisibilityStore.js.map +1 -0
- package/build/module/Carousel/hooks/useLoopedData.js +24 -0
- package/build/module/Carousel/hooks/useLoopedData.js.map +1 -0
- package/build/module/Carousel/hooks/usePagingAnimator.js +192 -0
- package/build/module/Carousel/hooks/usePagingAnimator.js.map +1 -0
- package/build/module/Carousel/index.js +2 -1
- package/build/module/Carousel/index.js.map +1 -1
- package/build/module/Carousel/tick.js +6 -0
- package/build/module/Carousel/tick.js.map +1 -0
- package/build/module/Carousel/types.js +4 -0
- package/build/module/Carousel/types.js.map +1 -0
- package/build/module/ComicViewer/ComicViewer.js +245 -88
- package/build/module/ComicViewer/ComicViewer.js.map +1 -1
- package/build/module/ComicViewer/ComicViewerProps.js.map +1 -1
- package/build/module/ComicViewer/EncodedTile.js +3 -0
- package/build/module/ComicViewer/EncodedTile.js.map +1 -0
- package/build/module/ComicViewer/FastScroll.js +141 -0
- package/build/module/ComicViewer/FastScroll.js.map +1 -0
- package/build/module/ComicViewer/FastScrollProps.js +2 -0
- package/build/module/ComicViewer/FastScrollProps.js.map +1 -0
- package/build/module/ComicViewer/ReloadButton.js +33 -0
- package/build/module/ComicViewer/ReloadButton.js.map +1 -0
- package/build/module/ComicViewer/ViewerItem.js +51 -59
- package/build/module/ComicViewer/ViewerItem.js.map +1 -1
- package/build/module/ComicViewer/index.js.map +1 -1
- package/build/module/ComicViewer/util.js +15 -0
- package/build/module/ComicViewer/util.js.map +1 -0
- package/build/module/DateTimePicker/DateTimePicker.js.map +1 -1
- package/build/module/DateTimePicker/DateTimePickerProps.js.map +1 -1
- package/build/module/DateTimePicker/DateTimePickerProvider.js.map +1 -1
- package/build/module/DateTimePicker/YearPicker.js +21 -17
- package/build/module/DateTimePicker/YearPicker.js.map +1 -1
- package/build/module/DateTimePicker/index.js.map +1 -1
- package/build/module/DateTimePicker/utils.js +2 -1
- package/build/module/DateTimePicker/utils.js.map +1 -1
- package/build/module/FlipCard/FlipCard.js +7 -7
- package/build/module/FlipCard/FlipCard.js.map +1 -1
- package/build/module/FlipCard/FlipCardProps.js.map +1 -1
- package/build/module/FlipCard/index.js.map +1 -1
- package/build/module/StatusBarProvider/Provider.js.map +1 -1
- package/build/module/StatusBarProvider/StatusBarProvider.js.map +1 -1
- package/build/module/StatusBarProvider/StatusBarProviderProps.js.map +1 -1
- package/build/module/StatusBarProvider/index.js.map +1 -1
- package/build/module/ViewPager/FluxContext.js +4 -0
- package/build/module/ViewPager/FluxContext.js.map +1 -0
- package/build/module/ViewPager/InternalContext.js +7 -0
- package/build/module/ViewPager/InternalContext.js.map +1 -0
- package/build/module/ViewPager/PageStateContext.js +7 -0
- package/build/module/ViewPager/PageStateContext.js.map +1 -0
- package/build/module/ViewPager/ViewPager.js +57 -0
- package/build/module/ViewPager/ViewPager.js.map +1 -0
- package/build/module/ViewPager/ViewPager.native.js +127 -0
- package/build/module/ViewPager/ViewPager.native.js.map +1 -0
- package/build/module/ViewPager/ViewPagerProps.js.map +1 -1
- package/build/module/ViewPager/components/ChildrenMemoizedPage.js +101 -0
- package/build/module/ViewPager/components/ChildrenMemoizedPage.js.map +1 -0
- package/build/module/ViewPager/components/FluxStoreProvider.js +20 -0
- package/build/module/ViewPager/components/FluxStoreProvider.js.map +1 -0
- package/build/module/ViewPager/components/index.js +3 -0
- package/build/module/ViewPager/components/index.js.map +1 -0
- package/build/module/ViewPager/hooks/index.js +8 -0
- package/build/module/ViewPager/hooks/index.js.map +1 -0
- package/build/module/ViewPager/hooks/useDispatch.js +10 -0
- package/build/module/ViewPager/hooks/useDispatch.js.map +1 -0
- package/build/module/ViewPager/hooks/useEagerState.js +12 -0
- package/build/module/ViewPager/hooks/useEagerState.js.map +1 -0
- package/build/module/ViewPager/hooks/useForceRender.js +7 -0
- package/build/module/ViewPager/hooks/useForceRender.js.map +1 -0
- package/build/module/ViewPager/hooks/useLazyState.js +30 -0
- package/build/module/ViewPager/hooks/useLazyState.js.map +1 -0
- package/build/module/ViewPager/hooks/usePageStore.js +25 -0
- package/build/module/ViewPager/hooks/usePageStore.js.map +1 -0
- package/build/module/ViewPager/hooks/useStore.js +14 -0
- package/build/module/ViewPager/hooks/useStore.js.map +1 -0
- package/build/module/ViewPager/hooks/useViewPagerPageState.js +7 -0
- package/build/module/ViewPager/hooks/useViewPagerPageState.js.map +1 -0
- package/build/module/ViewPager/index.js +3 -1
- package/build/module/ViewPager/index.js.map +1 -1
- package/build/module/ViewPager/types.js +2 -0
- package/build/module/ViewPager/types.js.map +1 -0
- package/build/module/ViewPager/utils.js +6 -33
- package/build/module/ViewPager/utils.js.map +1 -1
- package/build/module/ViewabilityTrackerView/Viewability.js +2 -0
- package/build/module/ViewabilityTrackerView/Viewability.js.map +1 -0
- package/build/module/ViewabilityTrackerView/ViewabilityTrackerView.js +28 -0
- package/build/module/ViewabilityTrackerView/ViewabilityTrackerView.js.map +1 -0
- package/build/module/ViewabilityTrackerView/ViewabilityTrackerViewProps.js +2 -0
- package/build/module/ViewabilityTrackerView/ViewabilityTrackerViewProps.js.map +1 -0
- package/build/module/ViewabilityTrackerView/index.js +2 -0
- package/build/module/ViewabilityTrackerView/index.js.map +1 -0
- package/build/module/ViewabilityTrackerView/measureViewability.js +34 -0
- package/build/module/ViewabilityTrackerView/measureViewability.js.map +1 -0
- package/build/module/ViewabilityTrackerView/useViewabilityTracker.js +73 -0
- package/build/module/ViewabilityTrackerView/useViewabilityTracker.js.map +1 -0
- package/build/module/hooks/index.js +2 -0
- package/build/module/hooks/index.js.map +1 -1
- package/build/module/hooks/useAppbarStyles.js.map +1 -1
- package/build/module/hooks/useDeferredExecutor.js +33 -0
- package/build/module/hooks/useDeferredExecutor.js.map +1 -0
- package/build/module/hooks/useElevationStyle.js.map +1 -1
- package/build/module/hooks/useHeight.js +4 -4
- package/build/module/hooks/useHeight.js.map +1 -1
- package/build/module/hooks/useIsMounted.js +13 -0
- package/build/module/hooks/useIsMounted.js.map +1 -0
- package/build/module/hooks/useUnstableCollapsibleAppBar.js +58 -45
- package/build/module/hooks/useUnstableCollapsibleAppBar.js.map +1 -1
- package/build/module/hooks/useUnstableToggleDisplayStyle.js +9 -7
- package/build/module/hooks/useUnstableToggleDisplayStyle.js.map +1 -1
- package/build/module/index.js +2 -0
- package/build/module/index.js.map +1 -1
- package/build/typescript/BottomSheet/BottomSheetProps.d.ts +18 -1
- package/build/typescript/BottomSheet/useDynamicSnapPoints.d.ts +12 -0
- package/build/typescript/Carousel/Carousel.d.ts +5 -0
- package/build/typescript/Carousel/CarouselProps.d.ts +33 -48
- package/build/typescript/Carousel/animation/animationUtils.d.ts +1 -0
- package/build/typescript/Carousel/animation/createDefaultItemStyle.d.ts +2 -0
- package/build/typescript/Carousel/animation/createDefaultScrollAnimation.d.ts +2 -0
- package/build/typescript/Carousel/animation/index.d.ts +4 -0
- package/build/typescript/Carousel/animation/normalItemStyleFactory.d.ts +2 -0
- package/build/typescript/Carousel/animation/parallaxItemStyleFactory.d.ts +9 -0
- package/build/typescript/Carousel/components/InternalContext.d.ts +14 -0
- package/build/typescript/Carousel/components/ItemView.d.ts +9 -0
- package/build/typescript/Carousel/components/RootView.d.ts +16 -0
- package/build/typescript/Carousel/components/ScrollViewGesture.d.ts +12 -0
- package/build/typescript/Carousel/components/index.d.ts +4 -0
- package/build/typescript/Carousel/components/useItemInterpolation.d.ts +2 -0
- package/build/typescript/Carousel/hooks/index.d.ts +5 -0
- package/build/typescript/Carousel/hooks/useAutoplayController.d.ts +7 -0
- package/build/typescript/Carousel/hooks/useIndexController.d.ts +10 -0
- package/build/typescript/Carousel/hooks/useItemVisibilityStore.d.ts +7 -0
- package/build/typescript/Carousel/hooks/useLoopedData.d.ts +1 -0
- package/build/typescript/Carousel/hooks/usePagingAnimator.d.ts +17 -0
- package/build/typescript/Carousel/index.d.ts +3 -1
- package/build/typescript/Carousel/tick.d.ts +2 -0
- package/build/typescript/Carousel/types.d.ts +91 -0
- package/build/typescript/ComicViewer/ComicViewer.d.ts +1 -1
- package/build/typescript/ComicViewer/ComicViewerProps.d.ts +56 -43
- package/build/typescript/ComicViewer/EncodedTile.d.ts +2 -0
- package/build/typescript/ComicViewer/FastScroll.d.ts +4 -0
- package/build/typescript/ComicViewer/FastScrollProps.d.ts +70 -0
- package/build/typescript/ComicViewer/ReloadButton.d.ts +7 -0
- package/build/typescript/ComicViewer/ViewerItem.d.ts +42 -7
- package/build/typescript/ComicViewer/index.d.ts +3 -2
- package/build/typescript/ComicViewer/util.d.ts +2 -0
- package/build/typescript/ViewPager/FluxContext.d.ts +5 -0
- package/build/typescript/ViewPager/InternalContext.d.ts +7 -0
- package/build/typescript/ViewPager/PageStateContext.d.ts +6 -0
- package/build/typescript/ViewPager/ViewPager.d.ts +5 -0
- package/build/typescript/ViewPager/ViewPager.native.d.ts +5 -0
- package/build/typescript/ViewPager/ViewPagerProps.d.ts +18 -29
- package/build/typescript/ViewPager/components/ChildrenMemoizedPage.d.ts +14 -0
- package/build/typescript/ViewPager/components/FluxStoreProvider.d.ts +6 -0
- package/build/typescript/ViewPager/components/index.d.ts +2 -0
- package/build/typescript/ViewPager/hooks/index.d.ts +7 -0
- package/build/typescript/ViewPager/hooks/useDispatch.d.ts +2 -0
- package/build/typescript/ViewPager/hooks/useEagerState.d.ts +1 -0
- package/build/typescript/ViewPager/hooks/useForceRender.d.ts +2 -0
- package/build/typescript/ViewPager/hooks/useLazyState.d.ts +2 -0
- package/build/typescript/ViewPager/hooks/usePageStore.d.ts +2 -0
- package/build/typescript/ViewPager/hooks/useStore.d.ts +2 -0
- package/build/typescript/ViewPager/hooks/useViewPagerPageState.d.ts +1 -0
- package/build/typescript/ViewPager/index.d.ts +4 -1
- package/build/typescript/ViewPager/types.d.ts +12 -0
- package/build/typescript/ViewPager/utils.d.ts +5 -20
- package/build/typescript/ViewabilityTrackerView/Viewability.d.ts +3 -0
- package/build/typescript/ViewabilityTrackerView/ViewabilityTrackerView.d.ts +3 -0
- package/build/typescript/ViewabilityTrackerView/ViewabilityTrackerViewProps.d.ts +22 -0
- package/build/typescript/ViewabilityTrackerView/index.d.ts +2 -0
- package/build/typescript/ViewabilityTrackerView/measureViewability.d.ts +11 -0
- package/build/typescript/ViewabilityTrackerView/useViewabilityTracker.d.ts +11 -0
- package/build/typescript/hooks/index.d.ts +2 -0
- package/build/typescript/hooks/useDeferredExecutor.d.ts +11 -0
- package/build/typescript/hooks/useIsMounted.d.ts +4 -0
- package/build/typescript/hooks/useUnstableCollapsibleAppBar.d.ts +2 -3
- package/build/typescript/hooks/useUnstableToggleDisplayStyle.d.ts +2 -2
- package/build/typescript/index.d.ts +2 -0
- package/package.json +13 -27
- package/src/AnimatedY/AnimatedY.tsx +13 -10
- package/src/BottomSheet/BottomSheetNative.tsx +30 -3
- package/src/BottomSheet/BottomSheetProps.ts +21 -1
- package/src/BottomSheet/BottomSheetWeb.tsx +32 -13
- package/src/BottomSheet/useDynamicSnapPoints.ts +73 -0
- package/src/Carousel/Carousel.tsx +135 -0
- package/src/Carousel/CarouselProps.ts +42 -53
- package/src/Carousel/animation/animationUtils.ts +1 -0
- package/src/Carousel/animation/createDefaultItemStyle.ts +3 -0
- package/src/Carousel/animation/createDefaultScrollAnimation.ts +13 -0
- package/src/Carousel/animation/index.ts +4 -0
- package/src/Carousel/animation/normalItemStyleFactory.ts +19 -0
- package/src/Carousel/animation/parallaxItemStyleFactory.ts +79 -0
- package/src/Carousel/components/InternalContext.ts +33 -0
- package/src/Carousel/components/ItemView.tsx +66 -0
- package/src/Carousel/components/RootView.tsx +79 -0
- package/src/Carousel/components/ScrollViewGesture.tsx +92 -0
- package/src/Carousel/components/index.ts +4 -0
- package/src/Carousel/components/useItemInterpolation.ts +107 -0
- package/src/Carousel/hooks/index.ts +5 -0
- package/src/Carousel/hooks/useAutoplayController.ts +57 -0
- package/src/Carousel/hooks/useIndexController.tsx +57 -0
- package/src/Carousel/hooks/useItemVisibilityStore.ts +107 -0
- package/src/Carousel/hooks/useLoopedData.ts +26 -0
- package/src/Carousel/hooks/usePagingAnimator.ts +255 -0
- package/src/Carousel/index.ts +4 -2
- package/src/Carousel/tick.ts +6 -0
- package/src/Carousel/types.ts +114 -0
- package/src/ComicViewer/ComicViewer.tsx +283 -104
- package/src/ComicViewer/ComicViewerProps.ts +60 -44
- package/src/ComicViewer/EncodedTile.ts +3 -0
- package/src/ComicViewer/FastScroll.tsx +158 -0
- package/src/ComicViewer/FastScrollProps.ts +83 -0
- package/src/ComicViewer/ReloadButton.tsx +36 -0
- package/src/ComicViewer/ViewerItem.tsx +97 -62
- package/src/ComicViewer/index.ts +8 -2
- package/src/ComicViewer/util.ts +15 -0
- package/src/FlipCard/FlipCard.tsx +8 -8
- package/src/ViewPager/FluxContext.ts +8 -0
- package/src/ViewPager/InternalContext.ts +13 -0
- package/src/ViewPager/PageStateContext.ts +11 -0
- package/src/ViewPager/ViewPager.native.tsx +150 -0
- package/src/ViewPager/ViewPager.tsx +69 -0
- package/src/ViewPager/ViewPagerProps.ts +20 -35
- package/src/ViewPager/components/ChildrenMemoizedPage.tsx +124 -0
- package/src/ViewPager/components/FluxStoreProvider.tsx +27 -0
- package/src/ViewPager/components/index.ts +2 -0
- package/src/ViewPager/hooks/index.ts +7 -0
- package/src/ViewPager/hooks/useDispatch.ts +11 -0
- package/src/ViewPager/hooks/useEagerState.ts +14 -0
- package/src/ViewPager/hooks/useForceRender.ts +7 -0
- package/src/ViewPager/hooks/useLazyState.ts +32 -0
- package/src/ViewPager/hooks/usePageStore.ts +30 -0
- package/src/ViewPager/hooks/useStore.ts +15 -0
- package/src/ViewPager/hooks/useViewPagerPageState.ts +6 -0
- package/src/ViewPager/index.ts +11 -2
- package/src/ViewPager/types.ts +15 -0
- package/src/ViewPager/utils.tsx +9 -56
- package/src/ViewabilityTrackerView/Viewability.ts +3 -0
- package/src/ViewabilityTrackerView/ViewabilityTrackerView.tsx +33 -0
- package/src/ViewabilityTrackerView/ViewabilityTrackerViewProps.ts +25 -0
- package/src/ViewabilityTrackerView/index.ts +2 -0
- package/src/ViewabilityTrackerView/measureViewability.ts +54 -0
- package/src/ViewabilityTrackerView/useViewabilityTracker.ts +85 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useDeferredExecutor.ts +46 -0
- package/src/hooks/useHeight.ts +3 -4
- package/src/hooks/useIsMounted.ts +19 -0
- package/src/hooks/useUnstableCollapsibleAppBar.ts +62 -45
- package/src/hooks/useUnstableToggleDisplayStyle.ts +8 -6
- package/src/index.ts +3 -0
- package/yarn-error.log +103 -0
- package/build/commonjs/Carousel/CarouselNative.js +0 -72
- package/build/commonjs/Carousel/CarouselNative.js.map +0 -1
- package/build/commonjs/Carousel/CarouselWeb.js +0 -237
- package/build/commonjs/Carousel/CarouselWeb.js.map +0 -1
- package/build/commonjs/Carousel/index.native.js.map +0 -1
- package/build/commonjs/Carousel/utils.js +0 -19
- package/build/commonjs/Carousel/utils.js.map +0 -1
- package/build/commonjs/ComicViewer/ComicViewerItemProps.js.map +0 -1
- package/build/commonjs/ViewPager/ChildrenMemoizedPage.js +0 -49
- package/build/commonjs/ViewPager/ChildrenMemoizedPage.js.map +0 -1
- package/build/commonjs/ViewPager/ViewPagerNative.js +0 -72
- package/build/commonjs/ViewPager/ViewPagerNative.js.map +0 -1
- package/build/commonjs/ViewPager/ViewPagerWeb.js +0 -55
- package/build/commonjs/ViewPager/ViewPagerWeb.js.map +0 -1
- package/build/commonjs/ViewPager/index.native.js +0 -16
- package/build/commonjs/ViewPager/index.native.js.map +0 -1
- package/build/commonjs/hooks/useWidth.js +0 -29
- package/build/commonjs/hooks/useWidth.js.map +0 -1
- package/build/module/Carousel/CarouselNative.js +0 -54
- package/build/module/Carousel/CarouselNative.js.map +0 -1
- package/build/module/Carousel/CarouselWeb.js +0 -215
- package/build/module/Carousel/CarouselWeb.js.map +0 -1
- package/build/module/Carousel/index.native.js +0 -2
- package/build/module/Carousel/index.native.js.map +0 -1
- package/build/module/Carousel/utils.js +0 -7
- package/build/module/Carousel/utils.js.map +0 -1
- package/build/module/ComicViewer/ComicViewerItemProps.js +0 -2
- package/build/module/ComicViewer/ComicViewerItemProps.js.map +0 -1
- package/build/module/ViewPager/ChildrenMemoizedPage.js +0 -37
- package/build/module/ViewPager/ChildrenMemoizedPage.js.map +0 -1
- package/build/module/ViewPager/ViewPagerNative.js +0 -53
- package/build/module/ViewPager/ViewPagerNative.js.map +0 -1
- package/build/module/ViewPager/ViewPagerWeb.js +0 -41
- package/build/module/ViewPager/ViewPagerWeb.js.map +0 -1
- package/build/module/ViewPager/index.native.js +0 -2
- package/build/module/ViewPager/index.native.js.map +0 -1
- package/build/module/hooks/useWidth.js +0 -15
- package/build/module/hooks/useWidth.js.map +0 -1
- package/build/typescript/Carousel/CarouselNative.d.ts +0 -3
- package/build/typescript/Carousel/CarouselWeb.d.ts +0 -4
- package/build/typescript/Carousel/index.native.d.ts +0 -1
- package/build/typescript/Carousel/utils.d.ts +0 -6
- package/build/typescript/ComicViewer/ComicViewerItemProps.d.ts +0 -12
- package/build/typescript/ViewPager/ChildrenMemoizedPage.d.ts +0 -4
- package/build/typescript/ViewPager/ViewPagerNative.d.ts +0 -3
- package/build/typescript/ViewPager/ViewPagerWeb.d.ts +0 -3
- package/build/typescript/ViewPager/index.native.d.ts +0 -1
- package/build/typescript/hooks/useWidth.d.ts +0 -2
- package/src/Carousel/CarouselNative.tsx +0 -67
- package/src/Carousel/CarouselWeb.tsx +0 -222
- package/src/Carousel/index.native.ts +0 -1
- package/src/Carousel/utils.ts +0 -11
- package/src/ComicViewer/ComicViewerItemProps.ts +0 -15
- package/src/ViewPager/ChildrenMemoizedPage.tsx +0 -36
- package/src/ViewPager/ViewPagerNative.tsx +0 -66
- package/src/ViewPager/ViewPagerWeb.tsx +0 -52
- package/src/ViewPager/index.native.ts +0 -1
- package/src/hooks/useWidth.ts +0 -17
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { RefObject } from 'react';
|
|
2
|
+
import { useEffect, useRef } from 'react';
|
|
3
|
+
import type { View } from 'react-native';
|
|
4
|
+
import { useValidWindowDimensions } from '@fountain-ui/core';
|
|
5
|
+
import { useDeferredExecutor } from '../hooks';
|
|
6
|
+
import type { ViewabilityDetail } from './measureViewability';
|
|
7
|
+
import measureViewability from './measureViewability';
|
|
8
|
+
import type Viewability from './Viewability';
|
|
9
|
+
|
|
10
|
+
export interface ViewabilityTrackerConfig {
|
|
11
|
+
enabled: boolean;
|
|
12
|
+
measurementIntervalMillis: number;
|
|
13
|
+
onViewabilityChange?: (viewability: Viewability) => void;
|
|
14
|
+
viewRef: RefObject<View>;
|
|
15
|
+
visiblePercentThreshold: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const initialViewability: Readonly<Viewability> = { visible: false };
|
|
19
|
+
|
|
20
|
+
export default function useViewabilityTracker(config: ViewabilityTrackerConfig) {
|
|
21
|
+
const {
|
|
22
|
+
enabled,
|
|
23
|
+
measurementIntervalMillis,
|
|
24
|
+
onViewabilityChange,
|
|
25
|
+
viewRef,
|
|
26
|
+
visiblePercentThreshold,
|
|
27
|
+
} = config;
|
|
28
|
+
|
|
29
|
+
const viewabilityRef = useRef<Viewability>(initialViewability);
|
|
30
|
+
|
|
31
|
+
const executor = useDeferredExecutor();
|
|
32
|
+
|
|
33
|
+
const window = useValidWindowDimensions();
|
|
34
|
+
|
|
35
|
+
const maybeMeasureRecursive = () => {
|
|
36
|
+
if (!enabled) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const mapViewabilityDetailToViewability = (detail: ViewabilityDetail): Viewability => {
|
|
41
|
+
return { visible: detail.visiblePercent >= visiblePercentThreshold };
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const isViewabilityEquals = (a: Viewability, b: Viewability): boolean => {
|
|
45
|
+
return a.visible === b.visible;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const dispatchViewabilityChanged = (viewability: Viewability) => {
|
|
49
|
+
executor.execute(() => onViewabilityChange?.(viewability));
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const onViewabilityDetailMeasured = (detail: ViewabilityDetail) => {
|
|
53
|
+
const nextViewability = mapViewabilityDetailToViewability(detail);
|
|
54
|
+
|
|
55
|
+
if (!isViewabilityEquals(viewabilityRef.current, nextViewability)) {
|
|
56
|
+
viewabilityRef.current = nextViewability;
|
|
57
|
+
|
|
58
|
+
dispatchViewabilityChanged(nextViewability);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
maybeMeasureRecursive();
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const maybeMeasure = () => {
|
|
65
|
+
if (viewRef.current) {
|
|
66
|
+
measureViewability({
|
|
67
|
+
view: viewRef.current,
|
|
68
|
+
windowWidth: window.width,
|
|
69
|
+
windowHeight: window.height,
|
|
70
|
+
onViewabilityDetailMeasured,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
executor.execute(maybeMeasure, measurementIntervalMillis);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
if (enabled) {
|
|
80
|
+
maybeMeasureRecursive();
|
|
81
|
+
} else {
|
|
82
|
+
executor.cancel();
|
|
83
|
+
}
|
|
84
|
+
}, [enabled]);
|
|
85
|
+
};
|
package/src/hooks/index.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export { default as useDeferredExecutor } from './useDeferredExecutor';
|
|
2
|
+
export { default as useIsMounted } from './useIsMounted';
|
|
1
3
|
export { default as useUnstableCollapsibleAppBar } from './useUnstableCollapsibleAppBar';
|
|
2
4
|
export { default as useUnstableToggleDisplayStyle } from './useUnstableToggleDisplayStyle';
|
|
3
5
|
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
2
|
+
import useIsMounted from './useIsMounted';
|
|
3
|
+
|
|
4
|
+
export interface Runnable {
|
|
5
|
+
(): void;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface DeferredExecute {
|
|
9
|
+
(runnable: Runnable, delay?: number): void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface DeferredExecutor {
|
|
13
|
+
cancel: () => void;
|
|
14
|
+
execute: DeferredExecute;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default function useDeferredExecutor(): DeferredExecutor {
|
|
18
|
+
const isMounted = useIsMounted();
|
|
19
|
+
const timeoutIdRef = useRef<NodeJS.Timer | null>(null);
|
|
20
|
+
|
|
21
|
+
const cancel = useCallback(() => {
|
|
22
|
+
if (timeoutIdRef.current) {
|
|
23
|
+
clearTimeout(timeoutIdRef.current);
|
|
24
|
+
}
|
|
25
|
+
}, []);
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
return cancel;
|
|
29
|
+
}, []);
|
|
30
|
+
|
|
31
|
+
const execute = useCallback<DeferredExecute>((runnable, delay) => {
|
|
32
|
+
if (!isMounted()) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
cancel();
|
|
37
|
+
|
|
38
|
+
if (Number.isFinite(delay)) {
|
|
39
|
+
timeoutIdRef.current = setTimeout(() => runnable(), delay);
|
|
40
|
+
} else {
|
|
41
|
+
runnable();
|
|
42
|
+
}
|
|
43
|
+
}, []);
|
|
44
|
+
|
|
45
|
+
return { cancel, execute };
|
|
46
|
+
};
|
package/src/hooks/useHeight.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ViewProps } from 'react-native';
|
|
3
|
-
import Animated from 'react-native-reanimated';
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { LayoutChangeEvent, ViewProps } from 'react-native';
|
|
4
3
|
|
|
5
4
|
type OnLayoutCallback = ViewProps['onLayout'];
|
|
6
5
|
|
|
7
6
|
export default function useHeight(initialHeight = 0): [number, OnLayoutCallback] {
|
|
8
7
|
const [height, setHeight] = React.useState<number>(initialHeight);
|
|
9
8
|
|
|
10
|
-
const onLayout =
|
|
9
|
+
const onLayout = useCallback((e: LayoutChangeEvent) => {
|
|
11
10
|
setHeight(e.nativeEvent.layout.height);
|
|
12
11
|
}, []);
|
|
13
12
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface UseIsMounted {
|
|
4
|
+
(): boolean;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export default function useIsMounted(): UseIsMounted {
|
|
8
|
+
const mountedRef = useRef<boolean>(false);
|
|
9
|
+
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
mountedRef.current = true;
|
|
12
|
+
|
|
13
|
+
return () => {
|
|
14
|
+
mountedRef.current = false;
|
|
15
|
+
};
|
|
16
|
+
}, []);
|
|
17
|
+
|
|
18
|
+
return useCallback(() => mountedRef.current, []);
|
|
19
|
+
};
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useCallback, useRef } from 'react';
|
|
2
2
|
import { Falsy, Platform, RegisteredStyle, ScrollViewProps, ViewProps, ViewStyle } from 'react-native';
|
|
3
|
-
import
|
|
3
|
+
import type { SharedValue } from 'react-native-reanimated';
|
|
4
|
+
import {
|
|
5
|
+
useAnimatedScrollHandler,
|
|
6
|
+
useAnimatedStyle,
|
|
7
|
+
useDerivedValue,
|
|
8
|
+
useSharedValue,
|
|
9
|
+
withTiming,
|
|
10
|
+
} from 'react-native-reanimated';
|
|
4
11
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
5
12
|
import useAppbarStyles from './useAppbarStyles';
|
|
6
13
|
import useElevationStyle from './useElevationStyle';
|
|
@@ -22,13 +29,12 @@ export interface ContentInsets {
|
|
|
22
29
|
}
|
|
23
30
|
|
|
24
31
|
export interface Options {
|
|
25
|
-
translucent?: boolean;
|
|
26
32
|
shouldTranslateYReset?: boolean;
|
|
27
33
|
}
|
|
28
34
|
|
|
29
35
|
export interface CollapsibleAppBar {
|
|
30
36
|
appBarStyle: ViewStyleProp;
|
|
31
|
-
vectorY:
|
|
37
|
+
vectorY: SharedValue<number>;
|
|
32
38
|
onAppBarLayout: OnLayoutCallback;
|
|
33
39
|
onCollapsibleToolbarLayout: OnLayoutCallback;
|
|
34
40
|
onScroll: OnScroll;
|
|
@@ -37,7 +43,6 @@ export interface CollapsibleAppBar {
|
|
|
37
43
|
}
|
|
38
44
|
|
|
39
45
|
const defaultOptions: Required<Options> = {
|
|
40
|
-
translucent: false,
|
|
41
46
|
shouldTranslateYReset: false,
|
|
42
47
|
};
|
|
43
48
|
|
|
@@ -45,7 +50,6 @@ const ANIMATION_DURATION_MILLIS = 100;
|
|
|
45
50
|
|
|
46
51
|
const SUPPORTS_DRAG_DETECTION = Platform.OS !== 'web';
|
|
47
52
|
|
|
48
|
-
|
|
49
53
|
function useLargerValueOfLastTwoValues(value: number) {
|
|
50
54
|
const refLatestTwoValues = useRef([0, 0]);
|
|
51
55
|
|
|
@@ -55,12 +59,8 @@ function useLargerValueOfLastTwoValues(value: number) {
|
|
|
55
59
|
return Math.max(...refLatestTwoValues.current);
|
|
56
60
|
}
|
|
57
61
|
|
|
58
|
-
|
|
59
62
|
export default function useUnstableCollapsibleAppBar(userOptions: Options = defaultOptions): CollapsibleAppBar {
|
|
60
|
-
const {
|
|
61
|
-
translucent,
|
|
62
|
-
shouldTranslateYReset,
|
|
63
|
-
}: Required<Options> = {
|
|
63
|
+
const { shouldTranslateYReset }: Required<Options> = {
|
|
64
64
|
...defaultOptions,
|
|
65
65
|
...userOptions,
|
|
66
66
|
};
|
|
@@ -73,38 +73,55 @@ export default function useUnstableCollapsibleAppBar(userOptions: Options = defa
|
|
|
73
73
|
const appBarMaxHeight = useLargerValueOfLastTwoValues(appBarHeight);
|
|
74
74
|
const [collapsibleToolbarHeight, onCollapsibleToolbarLayout] = useHeight();
|
|
75
75
|
|
|
76
|
-
const maxTranslateY =
|
|
76
|
+
const maxTranslateY = useDerivedValue(() => -collapsibleToolbarHeight, [collapsibleToolbarHeight]);
|
|
77
77
|
|
|
78
|
-
const translateY =
|
|
79
|
-
const lastTranslateY =
|
|
80
|
-
const lastOffsetY =
|
|
81
|
-
const prevOffsetY =
|
|
82
|
-
const overlapped =
|
|
83
|
-
const vectorY =
|
|
78
|
+
const translateY = useSharedValue<number>(0);
|
|
79
|
+
const lastTranslateY = useSharedValue<number>(0);
|
|
80
|
+
const lastOffsetY = useSharedValue<number>(0);
|
|
81
|
+
const prevOffsetY = useSharedValue<number>(0);
|
|
82
|
+
const overlapped = useSharedValue<boolean>(false);
|
|
83
|
+
const vectorY = useSharedValue<number>(0);
|
|
84
84
|
|
|
85
85
|
const elevationStyle = useElevationStyle(4);
|
|
86
|
-
const animatedStyle =
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
86
|
+
const animatedStyle = useAnimatedStyle(() => {
|
|
87
|
+
const transform = [{ translateY: translateY.value }];
|
|
88
|
+
|
|
89
|
+
if (Platform.OS === 'web') {
|
|
90
|
+
return {
|
|
91
|
+
transform,
|
|
92
|
+
boxShadow: overlapped.value ? elevationStyle?.boxShadow : 0,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
if (Platform.OS === 'android') {
|
|
96
|
+
return {
|
|
97
|
+
transform,
|
|
98
|
+
elevation: overlapped.value ? elevationStyle?.elevation : 0,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
if (Platform.OS === 'ios') {
|
|
102
|
+
return {
|
|
103
|
+
transform,
|
|
104
|
+
shadowColor: elevationStyle?.shadowColor,
|
|
105
|
+
shadowOffset: elevationStyle?.shadowOffset,
|
|
106
|
+
shadowRadius: elevationStyle?.shadowRadius,
|
|
107
|
+
shadowOpacity: overlapped.value ? elevationStyle?.shadowOpacity : 0,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
return {};
|
|
111
|
+
}, [
|
|
112
|
+
/**
|
|
113
|
+
* FIXME: Consider add `elevationStyle` to dependencies.
|
|
114
|
+
*/
|
|
115
|
+
]);
|
|
116
|
+
|
|
117
|
+
const indexRef = useRef<number>(0);
|
|
118
|
+
const offsetsRef = useRef<Array<number>>([]);
|
|
119
|
+
|
|
120
|
+
const onScrollViewChanged = useCallback((nextIndex: number) => {
|
|
104
121
|
const prevIndex = indexRef.current;
|
|
105
122
|
if (prevIndex === nextIndex) {
|
|
106
123
|
if (shouldTranslateYReset) {
|
|
107
|
-
translateY.value =
|
|
124
|
+
translateY.value = withTiming(0, {
|
|
108
125
|
duration: ANIMATION_DURATION_MILLIS,
|
|
109
126
|
});
|
|
110
127
|
|
|
@@ -128,15 +145,15 @@ export default function useUnstableCollapsibleAppBar(userOptions: Options = defa
|
|
|
128
145
|
|
|
129
146
|
// If next ScrollView's offset is too short, expand app bar.
|
|
130
147
|
if (translateY.value < 0 && savedOffsetY < appBarHeight) {
|
|
131
|
-
translateY.value =
|
|
148
|
+
translateY.value = withTiming(0, {
|
|
132
149
|
duration: ANIMATION_DURATION_MILLIS,
|
|
133
150
|
});
|
|
134
151
|
|
|
135
152
|
vectorY.value = 0;
|
|
136
153
|
}
|
|
137
|
-
};
|
|
154
|
+
}, [appBarHeight]);
|
|
138
155
|
|
|
139
|
-
const scrollHandler =
|
|
156
|
+
const scrollHandler = useAnimatedScrollHandler({
|
|
140
157
|
onBeginDrag: () => {
|
|
141
158
|
lastTranslateY.value = translateY.value;
|
|
142
159
|
},
|
|
@@ -162,13 +179,13 @@ export default function useUnstableCollapsibleAppBar(userOptions: Options = defa
|
|
|
162
179
|
} else {
|
|
163
180
|
if (offsetY > -maxTy) {
|
|
164
181
|
if (ty === 0) {
|
|
165
|
-
translateY.value =
|
|
182
|
+
translateY.value = withTiming(Math.min(Math.max(-offsetY, maxTy), 0), {
|
|
166
183
|
duration: ANIMATION_DURATION_MILLIS,
|
|
167
184
|
});
|
|
168
185
|
}
|
|
169
186
|
} else {
|
|
170
187
|
if (ty === maxTy) {
|
|
171
|
-
translateY.value =
|
|
188
|
+
translateY.value = withTiming(0, {
|
|
172
189
|
duration: ANIMATION_DURATION_MILLIS,
|
|
173
190
|
});
|
|
174
191
|
}
|
|
@@ -201,17 +218,17 @@ export default function useUnstableCollapsibleAppBar(userOptions: Options = defa
|
|
|
201
218
|
|
|
202
219
|
overlapped.value = offsetY + nextTranslateY > 0;
|
|
203
220
|
|
|
204
|
-
translateY.value =
|
|
221
|
+
translateY.value = withTiming(nextTranslateY, {
|
|
205
222
|
duration: ANIMATION_DURATION_MILLIS,
|
|
206
223
|
});
|
|
207
224
|
},
|
|
208
|
-
});
|
|
225
|
+
}, [appBarHeight]);
|
|
209
226
|
|
|
210
227
|
const hasCollapsible = collapsibleToolbarHeight > 0;
|
|
211
228
|
|
|
212
229
|
const appBarStyle = [
|
|
213
230
|
animatedStyle,
|
|
214
|
-
|
|
231
|
+
{ paddingTop: safeAreaInsets.top },
|
|
215
232
|
hasCollapsible ? styles.floating : undefined,
|
|
216
233
|
];
|
|
217
234
|
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { SharedValue } from 'react-native-reanimated';
|
|
2
|
+
import { useAnimatedReaction, useAnimatedStyle, useSharedValue } from 'react-native-reanimated';
|
|
2
3
|
|
|
3
4
|
export default function useAnimatedDisplayStyle(
|
|
4
|
-
vectorY:
|
|
5
|
+
vectorY: SharedValue<number>,
|
|
5
6
|
threshold: number = 200,
|
|
6
7
|
defaultDisplay: 'flex' | 'none' = 'flex',
|
|
7
8
|
) {
|
|
8
|
-
const display =
|
|
9
|
+
const display = useSharedValue(defaultDisplay);
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
useAnimatedReaction(
|
|
11
12
|
() => vectorY.value,
|
|
12
13
|
(vy) => {
|
|
13
14
|
if (vy >= threshold) {
|
|
@@ -16,9 +17,10 @@ export default function useAnimatedDisplayStyle(
|
|
|
16
17
|
display.value = 'flex';
|
|
17
18
|
}
|
|
18
19
|
},
|
|
20
|
+
[threshold],
|
|
19
21
|
);
|
|
20
22
|
|
|
21
|
-
return
|
|
23
|
+
return useAnimatedStyle(() => ({
|
|
22
24
|
display: display.value,
|
|
23
|
-
}));
|
|
25
|
+
}), []);
|
|
24
26
|
};
|
package/src/index.ts
CHANGED
|
@@ -19,4 +19,7 @@ export * from './ComicViewer';
|
|
|
19
19
|
export { default as StatusBarProvider, useStatusBarContext } from './StatusBarProvider';
|
|
20
20
|
export * from './StatusBarProvider';
|
|
21
21
|
|
|
22
|
+
export { default as ViewabilityTrackerView } from './ViewabilityTrackerView';
|
|
23
|
+
export * from './ViewabilityTrackerView';
|
|
24
|
+
|
|
22
25
|
export * from './hooks';
|
package/yarn-error.log
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
Arguments:
|
|
2
|
+
/Users/chan/.nvm/versions/node/v16.16.0/bin/node /usr/local/Cellar/yarn/1.22.19/libexec/bin/yarn.js add react-native-device-info
|
|
3
|
+
|
|
4
|
+
PATH:
|
|
5
|
+
/Users/chan/.nvm/versions/node/v16.16.0/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/chan/IdeaProjects/tappytoon/bin/git-ext:/Library/Java/JavaVirtualMachines/jdk-12.0.2.jdk/Contents/Home/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/chan/IdeaProjects/tappytoon/bin/git-ext:/Users/chan/Library/Android/sdk/tools:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/chan/IdeaProjects/tappytoon/bin/git-ext:/Users/chan/Library/Android/sdk/platform-tools:/Users/chan/library/android/sdk/tools:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/chan/IdeaProjects/tappytoon/bin/git-ext:/Library/Java/JavaVirtualMachines/jdk-12.0.2.jdk/Contents/Home/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/chan/IdeaProjects/tappytoon/bin/git-ext:/Users/chan/Library/Android/sdk/tools:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/chan/IdeaProjects/tappytoon/bin/git-ext:/Users/chan/Library/Android/sdk/platform-tools:/Users/hyungchanyuk/library/android/sdk/platform-tools:/Users/chan/WebstormProjects/tappytoon/bin/git-ext
|
|
6
|
+
|
|
7
|
+
Yarn version:
|
|
8
|
+
1.22.19
|
|
9
|
+
|
|
10
|
+
Node version:
|
|
11
|
+
16.16.0
|
|
12
|
+
|
|
13
|
+
Platform:
|
|
14
|
+
darwin x64
|
|
15
|
+
|
|
16
|
+
Trace:
|
|
17
|
+
SyntaxError: /Users/chan/WebstormProjects/tappytoon/nodejs/fountain-ui/packages/fountain-ui-lab/package.json: Unexpected token } in JSON at position 681
|
|
18
|
+
at JSON.parse (<anonymous>)
|
|
19
|
+
at /usr/local/Cellar/yarn/1.22.19/libexec/lib/cli.js:1629:59
|
|
20
|
+
at Generator.next (<anonymous>)
|
|
21
|
+
at step (/usr/local/Cellar/yarn/1.22.19/libexec/lib/cli.js:310:30)
|
|
22
|
+
at /usr/local/Cellar/yarn/1.22.19/libexec/lib/cli.js:321:13
|
|
23
|
+
|
|
24
|
+
npm manifest:
|
|
25
|
+
{
|
|
26
|
+
"name": "@fountain-ui/lab",
|
|
27
|
+
"version": "2.0.0-beta.45",
|
|
28
|
+
"private": false,
|
|
29
|
+
"author": "Fountain-UI Team",
|
|
30
|
+
"description": "Incubator for Fountain-UI React components.",
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"main": "./build/commonjs/index.js",
|
|
33
|
+
"module": "./build/module/index.js",
|
|
34
|
+
"react-native": "./src/index.ts",
|
|
35
|
+
"source": "./src/index.ts",
|
|
36
|
+
"types": "./build/typescript/index.d.ts",
|
|
37
|
+
"scripts": {
|
|
38
|
+
"clean": "rimraf build",
|
|
39
|
+
"prepare": "bob build"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@emotion/react": "^11.10.0",
|
|
43
|
+
"@emotion/styled": "^11.10.0",
|
|
44
|
+
"@fountain-ui/icons": "^2.0.0-beta.9",
|
|
45
|
+
"@fountain-ui/utils": "^2.0.0-beta.4",
|
|
46
|
+
"react-native-calendars": "1.1267.0",
|
|
47
|
+
},
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"@fountain-ui/core": "^2.0.0-beta.3",
|
|
50
|
+
"@gorhom/bottom-sheet": "^4.5.0",
|
|
51
|
+
"date-fns": "^2.0.0",
|
|
52
|
+
"react": "^16.8.0 || ^17.0.0",
|
|
53
|
+
"react-dom": "^16.8.0 || ^17.0.0",
|
|
54
|
+
"react-native": "^0.63.0",
|
|
55
|
+
"react-native-gesture-handler": "^2.0.0",
|
|
56
|
+
"react-native-pager-view": "^4.0.0"
|
|
57
|
+
},
|
|
58
|
+
"peerDependenciesMeta": {
|
|
59
|
+
"@gorhom/bottom-sheet": {
|
|
60
|
+
"optional": true
|
|
61
|
+
},
|
|
62
|
+
"react-dom": {
|
|
63
|
+
"optional": true
|
|
64
|
+
},
|
|
65
|
+
"react-native-pager-view": {
|
|
66
|
+
"optional": true
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"devDependencies": {
|
|
70
|
+
"@gorhom/bottom-sheet": "^4.5.0",
|
|
71
|
+
"date-fns": "^2.23.0",
|
|
72
|
+
"react-native-pager-view": "^4.2.4",
|
|
73
|
+
"react-native-safe-area-context": "^4.0.0"
|
|
74
|
+
},
|
|
75
|
+
"react-native-builder-bob": {
|
|
76
|
+
"source": "./src",
|
|
77
|
+
"output": "./build",
|
|
78
|
+
"targets": [
|
|
79
|
+
"commonjs",
|
|
80
|
+
"module",
|
|
81
|
+
[
|
|
82
|
+
"typescript",
|
|
83
|
+
{
|
|
84
|
+
"project": "tsconfig.build.json",
|
|
85
|
+
"tsc": "../../node_modules/.bin/tsc"
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
],
|
|
89
|
+
"files": [
|
|
90
|
+
"./src",
|
|
91
|
+
"./build"
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
"publishConfig": {
|
|
95
|
+
"access": "public"
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
yarn manifest:
|
|
100
|
+
No manifest
|
|
101
|
+
|
|
102
|
+
Lockfile:
|
|
103
|
+
No lockfile
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = Carousel;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
|
-
var _reactNative = require("react-native");
|
|
11
|
-
|
|
12
|
-
var _reactNativeSnapCarousel = _interopRequireDefault(require("react-native-snap-carousel"));
|
|
13
|
-
|
|
14
|
-
var _utils = require("./utils");
|
|
15
|
-
|
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
-
|
|
20
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
-
|
|
22
|
-
function Carousel(props) {
|
|
23
|
-
const {
|
|
24
|
-
autoplay = _utils.defaultAutoplay,
|
|
25
|
-
autoplayInterval = _utils.defaultAutoplayInterval,
|
|
26
|
-
centerSlidePadding,
|
|
27
|
-
data,
|
|
28
|
-
inactiveSlideOpacity = _utils.defaultInactiveSlideOpacity,
|
|
29
|
-
inactiveSlideScale = _utils.defaultInactiveSlideScale,
|
|
30
|
-
index,
|
|
31
|
-
infinite = _utils.defaultInfinite,
|
|
32
|
-
onChange,
|
|
33
|
-
renderItem
|
|
34
|
-
} = props;
|
|
35
|
-
const carouselRef = (0, _react.useRef)(null);
|
|
36
|
-
const [sliderWidth, setSliderWidth] = (0, _react.useState)(() => _reactNative.Dimensions.get('window').width);
|
|
37
|
-
const itemWidth = centerSlidePadding !== undefined ? sliderWidth - centerSlidePadding * 2 : sliderWidth;
|
|
38
|
-
(0, _react.useEffect)(() => {
|
|
39
|
-
const carousel = carouselRef.current;
|
|
40
|
-
|
|
41
|
-
if (carousel && index !== carousel.currentIndex) {
|
|
42
|
-
carousel.snapToItem(index, true);
|
|
43
|
-
}
|
|
44
|
-
}, [index]);
|
|
45
|
-
|
|
46
|
-
const handleSnapToItem = newIndex => {
|
|
47
|
-
if (onChange) {
|
|
48
|
-
onChange(newIndex);
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
53
|
-
onLayout: event => setSliderWidth(event.nativeEvent.layout.width)
|
|
54
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNativeSnapCarousel.default, {
|
|
55
|
-
autoplay: autoplay,
|
|
56
|
-
autoplayInterval: autoplayInterval,
|
|
57
|
-
data: data,
|
|
58
|
-
horizontal: true,
|
|
59
|
-
inactiveSlideOpacity: inactiveSlideOpacity,
|
|
60
|
-
inactiveSlideScale: inactiveSlideScale,
|
|
61
|
-
itemWidth: itemWidth,
|
|
62
|
-
loop: infinite,
|
|
63
|
-
loopClonesPerSide: 2,
|
|
64
|
-
onSnapToItem: handleSnapToItem,
|
|
65
|
-
ref: carouselRef,
|
|
66
|
-
renderItem: renderItem,
|
|
67
|
-
sliderWidth: sliderWidth
|
|
68
|
-
}));
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
;
|
|
72
|
-
//# sourceMappingURL=CarouselNative.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["CarouselNative.tsx"],"names":["Carousel","props","autoplay","defaultAutoplay","autoplayInterval","defaultAutoplayInterval","centerSlidePadding","data","inactiveSlideOpacity","defaultInactiveSlideOpacity","inactiveSlideScale","defaultInactiveSlideScale","index","infinite","defaultInfinite","onChange","renderItem","carouselRef","sliderWidth","setSliderWidth","Dimensions","get","width","itemWidth","undefined","carousel","current","currentIndex","snapToItem","handleSnapToItem","newIndex","event","nativeEvent","layout"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAEA;;;;;;;;AAQe,SAASA,QAAT,CAAyBC,KAAzB,EAAsD;AACjE,QAAM;AACFC,IAAAA,QAAQ,GAAGC,sBADT;AAEFC,IAAAA,gBAAgB,GAAGC,8BAFjB;AAGFC,IAAAA,kBAHE;AAIFC,IAAAA,IAJE;AAKFC,IAAAA,oBAAoB,GAAGC,kCALrB;AAMFC,IAAAA,kBAAkB,GAAGC,gCANnB;AAOFC,IAAAA,KAPE;AAQFC,IAAAA,QAAQ,GAAGC,sBART;AASFC,IAAAA,QATE;AAUFC,IAAAA;AAVE,MAWFf,KAXJ;AAaA,QAAMgB,WAAW,GAAG,mBAAqC,IAArC,CAApB;AAEA,QAAM,CAACC,WAAD,EAAcC,cAAd,IAAgC,qBAAS,MAAMC,wBAAWC,GAAX,CAAe,QAAf,EAAyBC,KAAxC,CAAtC;AAEA,QAAMC,SAAS,GAAGjB,kBAAkB,KAAKkB,SAAvB,GACZN,WAAW,GAAIZ,kBAAkB,GAAG,CADxB,GAEZY,WAFN;AAIA,wBAAU,MAAM;AACZ,UAAMO,QAAQ,GAAGR,WAAW,CAACS,OAA7B;;AACA,QAAID,QAAQ,IAAIb,KAAK,KAAKa,QAAQ,CAACE,YAAnC,EAAiD;AAC7CF,MAAAA,QAAQ,CAACG,UAAT,CAAoBhB,KAApB,EAA2B,IAA3B;AACH;AACJ,GALD,EAKG,CAACA,KAAD,CALH;;AAOA,QAAMiB,gBAAgB,GAAIC,QAAD,IAAsB;AAC3C,QAAIf,QAAJ,EAAc;AACVA,MAAAA,QAAQ,CAACe,QAAD,CAAR;AACH;AACJ,GAJD;;AAMA,sBACI,6BAAC,iBAAD;AAAM,IAAA,QAAQ,EAAGC,KAAD,IAAWZ,cAAc,CAACY,KAAK,CAACC,WAAN,CAAkBC,MAAlB,CAAyBX,KAA1B;AAAzC,kBACI,6BAAC,gCAAD;AACI,IAAA,QAAQ,EAAEpB,QADd;AAEI,IAAA,gBAAgB,EAAEE,gBAFtB;AAGI,IAAA,IAAI,EAAEG,IAHV;AAII,IAAA,UAAU,EAAE,IAJhB;AAKI,IAAA,oBAAoB,EAAEC,oBAL1B;AAMI,IAAA,kBAAkB,EAAEE,kBANxB;AAOI,IAAA,SAAS,EAAEa,SAPf;AAQI,IAAA,IAAI,EAAEV,QARV;AASI,IAAA,iBAAiB,EAAE,CATvB;AAUI,IAAA,YAAY,EAAEgB,gBAVlB;AAWI,IAAA,GAAG,EAAEZ,WAXT;AAYI,IAAA,UAAU,EAAED,UAZhB;AAaI,IAAA,WAAW,EAAEE;AAbjB,IADJ,CADJ;AAmBH;;AAAA","sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\nimport { Dimensions, View } from 'react-native';\nimport RNSnapCarousel from 'react-native-snap-carousel';\nimport type CarouselProps from './CarouselProps';\nimport {\n defaultAutoplay,\n defaultAutoplayInterval,\n defaultInactiveSlideOpacity,\n defaultInactiveSlideScale,\n defaultInfinite,\n} from './utils';\n\nexport default function Carousel<ItemT>(props: CarouselProps<ItemT>) {\n const {\n autoplay = defaultAutoplay,\n autoplayInterval = defaultAutoplayInterval,\n centerSlidePadding,\n data,\n inactiveSlideOpacity = defaultInactiveSlideOpacity,\n inactiveSlideScale = defaultInactiveSlideScale,\n index,\n infinite = defaultInfinite,\n onChange,\n renderItem,\n } = props;\n\n const carouselRef = useRef<RNSnapCarousel<ItemT> | null>(null);\n\n const [sliderWidth, setSliderWidth] = useState(() => Dimensions.get('window').width);\n\n const itemWidth = centerSlidePadding !== undefined\n ? sliderWidth - (centerSlidePadding * 2)\n : sliderWidth;\n\n useEffect(() => {\n const carousel = carouselRef.current;\n if (carousel && index !== carousel.currentIndex) {\n carousel.snapToItem(index, true);\n }\n }, [index]);\n\n const handleSnapToItem = (newIndex: number) => {\n if (onChange) {\n onChange(newIndex);\n }\n };\n\n return (\n <View onLayout={(event) => setSliderWidth(event.nativeEvent.layout.width)}>\n <RNSnapCarousel\n autoplay={autoplay}\n autoplayInterval={autoplayInterval}\n data={data}\n horizontal={true}\n inactiveSlideOpacity={inactiveSlideOpacity}\n inactiveSlideScale={inactiveSlideScale}\n itemWidth={itemWidth}\n loop={infinite}\n loopClonesPerSide={2}\n onSnapToItem={handleSnapToItem}\n ref={carouselRef}\n renderItem={renderItem}\n sliderWidth={sliderWidth}\n />\n </View>\n );\n};\n"]}
|