@fountain-ui/lab 2.0.0-beta.8 → 2.0.0-beta.81
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 +8 -10
- package/build/commonjs/AnimatedY/AnimatedY.js.map +1 -1
- package/build/commonjs/BottomSheet/BottomSheetNative.js +65 -7
- package/build/commonjs/BottomSheet/BottomSheetNative.js.map +1 -1
- package/build/commonjs/BottomSheet/BottomSheetProps.js.map +1 -1
- package/build/commonjs/BottomSheet/BottomSheetWeb.js +41 -13
- package/build/commonjs/BottomSheet/BottomSheetWeb.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 +26 -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 +84 -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 +230 -92
- 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 +175 -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 +53 -59
- 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 +10 -1
- package/build/commonjs/DateTimePicker/DateTimePicker.js.map +1 -1
- package/build/commonjs/FlipCard/FlipCard.js +2 -2
- package/build/commonjs/FlipCard/FlipCard.js.map +1 -1
- package/build/commonjs/StatusBarProvider/Provider.js.map +1 -1
- package/build/commonjs/StatusBarProvider/StatusBarProvider.js +111 -2
- package/build/commonjs/StatusBarProvider/StatusBarProvider.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 +14 -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 +152 -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 +43 -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 -45
- 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/useDeferredExecutor.js +45 -0
- package/build/commonjs/hooks/useDeferredExecutor.js.map +1 -0
- package/build/commonjs/hooks/useHeight.js +4 -4
- 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 +19 -25
- package/build/commonjs/hooks/useUnstableCollapsibleAppBar.js.map +1 -1
- package/build/commonjs/hooks/useUnstableToggleDisplayStyle.js +2 -2
- package/build/commonjs/hooks/useUnstableToggleDisplayStyle.js.map +1 -1
- package/build/commonjs/index.js +22 -1
- package/build/commonjs/index.js.map +1 -1
- package/build/module/AnimatedY/AnimatedY.js +8 -7
- package/build/module/AnimatedY/AnimatedY.js.map +1 -1
- package/build/module/BottomSheet/BottomSheetNative.js +64 -9
- package/build/module/BottomSheet/BottomSheetNative.js.map +1 -1
- package/build/module/BottomSheet/BottomSheetProps.js.map +1 -1
- package/build/module/BottomSheet/BottomSheetWeb.js +40 -14
- package/build/module/BottomSheet/BottomSheetWeb.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 +12 -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 +69 -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 +229 -93
- 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 +152 -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 +53 -60
- 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 +11 -2
- package/build/module/DateTimePicker/DateTimePicker.js.map +1 -1
- package/build/module/FlipCard/FlipCard.js +2 -2
- package/build/module/FlipCard/FlipCard.js.map +1 -1
- package/build/module/StatusBarProvider/Provider.js.map +1 -1
- package/build/module/StatusBarProvider/StatusBarProvider.js +105 -2
- package/build/module/StatusBarProvider/StatusBarProvider.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 +5 -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 +129 -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 +28 -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 -34
- 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/useDeferredExecutor.js +33 -0
- package/build/module/hooks/useDeferredExecutor.js.map +1 -0
- package/build/module/hooks/useHeight.js +2 -3
- 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 +19 -19
- package/build/module/hooks/useUnstableCollapsibleAppBar.js.map +1 -1
- package/build/module/hooks/useUnstableToggleDisplayStyle.js +2 -2
- 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/AnimatedY/AnimatedY.d.ts +1 -0
- package/build/typescript/BottomSheet/BottomSheetNative.d.ts +1 -0
- package/build/typescript/BottomSheet/BottomSheetProps.d.ts +32 -1
- package/build/typescript/BottomSheet/BottomSheetWeb.d.ts +1 -0
- package/build/typescript/BottomSheet/TransparentBackdrop.d.ts +1 -0
- 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 +2 -1
- package/build/typescript/ComicViewer/ComicViewerProps.d.ts +61 -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 +74 -0
- package/build/typescript/ComicViewer/ReloadButton.d.ts +7 -0
- package/build/typescript/ComicViewer/ViewerItem.d.ts +46 -7
- package/build/typescript/ComicViewer/index.d.ts +3 -2
- package/build/typescript/ComicViewer/util.d.ts +2 -0
- package/build/typescript/DateTimePicker/DateTimePicker.d.ts +1 -0
- package/build/typescript/DateTimePicker/YearPicker.d.ts +1 -0
- package/build/typescript/FlipCard/FlipCard.d.ts +1 -0
- package/build/typescript/StatusBarProvider/Provider.d.ts +13 -0
- package/build/typescript/StatusBarProvider/StatusBarProvider.d.ts +1 -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 +21 -27
- 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/index.d.ts +2 -0
- package/package.json +9 -24
- package/src/AnimatedY/AnimatedY.tsx +10 -7
- package/src/BottomSheet/BottomSheetNative.tsx +68 -6
- package/src/BottomSheet/BottomSheetProps.ts +38 -1
- package/src/BottomSheet/BottomSheetWeb.tsx +54 -16
- 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 +14 -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 +93 -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 +268 -106
- package/src/ComicViewer/ComicViewerProps.ts +66 -44
- package/src/ComicViewer/EncodedTile.ts +3 -0
- package/src/ComicViewer/FastScroll.tsx +176 -0
- package/src/ComicViewer/FastScrollProps.ts +88 -0
- package/src/ComicViewer/ReloadButton.tsx +36 -0
- package/src/ComicViewer/ViewerItem.tsx +104 -62
- package/src/ComicViewer/index.ts +8 -2
- package/src/ComicViewer/util.ts +15 -0
- package/src/DateTimePicker/DateTimePicker.tsx +9 -1
- package/src/FlipCard/FlipCard.tsx +2 -2
- package/src/StatusBarProvider/Provider.ts +14 -0
- package/src/StatusBarProvider/StatusBarProvider.tsx +103 -1
- 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 +152 -0
- package/src/ViewPager/ViewPager.tsx +69 -0
- package/src/ViewPager/ViewPagerProps.ts +25 -34
- 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 +17 -13
- package/src/hooks/useUnstableToggleDisplayStyle.ts +2 -1
- package/src/index.ts +3 -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 -75
- 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/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 -58
- 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/typescript/Carousel/CarouselNative.d.ts +0 -2
- 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 -2
- package/build/typescript/ViewPager/ViewPagerWeb.d.ts +0 -2
- package/build/typescript/ViewPager/index.native.d.ts +0 -1
- 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 -73
- package/src/ViewPager/ViewPagerWeb.tsx +0 -52
- package/src/ViewPager/index.native.ts +0 -1
package/src/ViewPager/utils.tsx
CHANGED
|
@@ -1,62 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import ViewPagerProps, { Loading, PageComponent } from './ViewPagerProps';
|
|
3
|
-
import ChildrenMemoizedPage from './ChildrenMemoizedPage';
|
|
1
|
+
import type { EqualityFunction, Loading } from './types';
|
|
4
2
|
|
|
5
|
-
export
|
|
6
|
-
visited?: boolean;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface PageRenderOption {
|
|
10
|
-
enableVisibleHint: boolean;
|
|
11
|
-
enableNeighborPageRerender: boolean;
|
|
12
|
-
index: number;
|
|
13
|
-
loading: Loading;
|
|
14
|
-
pageComponent: PageComponent;
|
|
15
|
-
pageForceRerenderKey?: any;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface PageRenderer {
|
|
19
|
-
(children: ViewPagerProps['children']): React.ReactNode;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export const defaultEnableVisibleHint: boolean = false;
|
|
23
|
-
|
|
24
|
-
export const defaultEnableNeighborPageRerender: boolean = false;
|
|
3
|
+
export const defaultInitialPage: number = 0;
|
|
25
4
|
|
|
26
5
|
export const defaultLoading: Loading = 'lazy';
|
|
27
6
|
|
|
28
|
-
export const
|
|
29
|
-
|
|
30
|
-
export const usePageRenderer = ({
|
|
31
|
-
enableVisibleHint,
|
|
32
|
-
index: currentIndex,
|
|
33
|
-
loading,
|
|
34
|
-
pageComponent: PageComponent,
|
|
35
|
-
pageForceRerenderKey,
|
|
36
|
-
enableNeighborPageRerender,
|
|
37
|
-
}: PageRenderOption): PageRenderer => {
|
|
38
|
-
const pagesStateRef = React.useRef<Array<PageState>>([]);
|
|
39
|
-
|
|
40
|
-
pagesStateRef.current[currentIndex] = {
|
|
41
|
-
...pagesStateRef.current[currentIndex],
|
|
42
|
-
visited: true,
|
|
43
|
-
};
|
|
7
|
+
export const defaultOffscreenPageRerenderLimit: number = 0;
|
|
44
8
|
|
|
45
|
-
|
|
46
|
-
const visited = pagesStateRef.current[index]?.visited ?? false;
|
|
47
|
-
const content = (loading === 'eager' || visited) ? child : null;
|
|
9
|
+
export const refEqual: EqualityFunction<any> = (a: any, b: any) => a === b;
|
|
48
10
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
key={index}
|
|
55
|
-
children={content}
|
|
56
|
-
isNeighbor={enableNeighborPageRerender && isNeighborIndex}
|
|
57
|
-
isVisible={isVisible}
|
|
58
|
-
rerenderKey={pageForceRerenderKey}
|
|
59
|
-
/>
|
|
60
|
-
);
|
|
61
|
-
}));
|
|
62
|
-
};
|
|
11
|
+
export function isValidPage(maybePage: number, numberOfPages: number) {
|
|
12
|
+
return Number.isInteger(maybePage)
|
|
13
|
+
&& maybePage >= 0
|
|
14
|
+
&& maybePage < numberOfPages;
|
|
15
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import useViewabilityTracker from './useViewabilityTracker';
|
|
4
|
+
import type ViewabilityTrackerViewProps from './ViewabilityTrackerViewProps';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export default function ViewabilityTrackerView(props: ViewabilityTrackerViewProps) {
|
|
8
|
+
const {
|
|
9
|
+
enabled = true,
|
|
10
|
+
measurementIntervalMillis = 1000,
|
|
11
|
+
onViewabilityChange,
|
|
12
|
+
visiblePercentThreshold = 50,
|
|
13
|
+
...otherProps
|
|
14
|
+
} = props;
|
|
15
|
+
|
|
16
|
+
const viewRef = useRef<View>(null);
|
|
17
|
+
|
|
18
|
+
useViewabilityTracker({
|
|
19
|
+
enabled,
|
|
20
|
+
measurementIntervalMillis,
|
|
21
|
+
onViewabilityChange,
|
|
22
|
+
viewRef,
|
|
23
|
+
visiblePercentThreshold,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<View
|
|
28
|
+
{...otherProps}
|
|
29
|
+
ref={viewRef}
|
|
30
|
+
collapsable={false}
|
|
31
|
+
/>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ViewProps } from 'react-native';
|
|
2
|
+
import type { OverridableComponentProps } from '@fountain-ui/core';
|
|
3
|
+
import type Viewability from './Viewability';
|
|
4
|
+
|
|
5
|
+
export default interface ViewabilityTrackerViewProps extends OverridableComponentProps<ViewProps, {
|
|
6
|
+
/**
|
|
7
|
+
* @default true
|
|
8
|
+
*/
|
|
9
|
+
enabled?: boolean;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @default 1000
|
|
13
|
+
*/
|
|
14
|
+
measurementIntervalMillis?: number;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
onViewabilityChange?: (viewability: Viewability) => void;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @default 50
|
|
23
|
+
*/
|
|
24
|
+
visiblePercentThreshold?: number;
|
|
25
|
+
}> {}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { View } from 'react-native';
|
|
2
|
+
import { clamp } from '@fountain-ui/utils';
|
|
3
|
+
|
|
4
|
+
interface Rect {
|
|
5
|
+
top: number,
|
|
6
|
+
bottom: number;
|
|
7
|
+
left: number;
|
|
8
|
+
right: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface ViewabilityDetail {
|
|
12
|
+
visiblePercent: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface MeasureViewabilityParameters {
|
|
16
|
+
view: View;
|
|
17
|
+
windowWidth: number;
|
|
18
|
+
windowHeight: number;
|
|
19
|
+
onViewabilityDetailMeasured: (detail: ViewabilityDetail) => void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const computeRectSize = (rect: Rect): number =>
|
|
23
|
+
(rect.bottom - rect.top) * (rect.right - rect.left);
|
|
24
|
+
|
|
25
|
+
const normalizePagePosition = (value?: number): number =>
|
|
26
|
+
(value != null && Number.isFinite(value)) ? value : Number.MAX_SAFE_INTEGER;
|
|
27
|
+
|
|
28
|
+
const normalizeViewSize = (size: number): number =>
|
|
29
|
+
Number.isFinite(size) && size > 0 ? size : Number.MAX_SAFE_INTEGER;
|
|
30
|
+
|
|
31
|
+
export default function measureViewability({
|
|
32
|
+
view,
|
|
33
|
+
windowWidth,
|
|
34
|
+
windowHeight,
|
|
35
|
+
onViewabilityDetailMeasured,
|
|
36
|
+
}: MeasureViewabilityParameters) {
|
|
37
|
+
view.measure((x, y, width, height, pageX?: number, pageY?: number) => {
|
|
38
|
+
const safePageX = normalizePagePosition(pageX);
|
|
39
|
+
const safePageY = normalizePagePosition(pageY);
|
|
40
|
+
|
|
41
|
+
const visibleRect: Rect = {
|
|
42
|
+
top: clamp(safePageY, 0, windowHeight),
|
|
43
|
+
bottom: clamp(safePageY + height, 0, windowHeight),
|
|
44
|
+
left: clamp(safePageX, 0, windowWidth),
|
|
45
|
+
right: clamp(safePageX + width, 0, windowWidth),
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const visibleRectSize = computeRectSize(visibleRect);
|
|
49
|
+
const viewSize = normalizeViewSize(width * height);
|
|
50
|
+
const visiblePercent = Math.round(visibleRectSize / viewSize * 100);
|
|
51
|
+
|
|
52
|
+
onViewabilityDetailMeasured?.({ visiblePercent });
|
|
53
|
+
});
|
|
54
|
+
};
|
|
@@ -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 { useWorkletCallback } 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,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useCallback, useRef } from 'react';
|
|
2
2
|
import { Falsy, Platform, RegisteredStyle, ScrollViewProps, ViewProps, ViewStyle } from 'react-native';
|
|
3
3
|
import type { SharedValue } from 'react-native-reanimated';
|
|
4
4
|
import {
|
|
@@ -50,7 +50,6 @@ const ANIMATION_DURATION_MILLIS = 100;
|
|
|
50
50
|
|
|
51
51
|
const SUPPORTS_DRAG_DETECTION = Platform.OS !== 'web';
|
|
52
52
|
|
|
53
|
-
|
|
54
53
|
function useLargerValueOfLastTwoValues(value: number) {
|
|
55
54
|
const refLatestTwoValues = useRef([0, 0]);
|
|
56
55
|
|
|
@@ -60,7 +59,6 @@ function useLargerValueOfLastTwoValues(value: number) {
|
|
|
60
59
|
return Math.max(...refLatestTwoValues.current);
|
|
61
60
|
}
|
|
62
61
|
|
|
63
|
-
|
|
64
62
|
export default function useUnstableCollapsibleAppBar(userOptions: Options = defaultOptions): CollapsibleAppBar {
|
|
65
63
|
const { shouldTranslateYReset }: Required<Options> = {
|
|
66
64
|
...defaultOptions,
|
|
@@ -75,7 +73,7 @@ export default function useUnstableCollapsibleAppBar(userOptions: Options = defa
|
|
|
75
73
|
const appBarMaxHeight = useLargerValueOfLastTwoValues(appBarHeight);
|
|
76
74
|
const [collapsibleToolbarHeight, onCollapsibleToolbarLayout] = useHeight();
|
|
77
75
|
|
|
78
|
-
const maxTranslateY = useDerivedValue(() => -collapsibleToolbarHeight);
|
|
76
|
+
const maxTranslateY = useDerivedValue(() => -collapsibleToolbarHeight, [collapsibleToolbarHeight]);
|
|
79
77
|
|
|
80
78
|
const translateY = useSharedValue<number>(0);
|
|
81
79
|
const lastTranslateY = useSharedValue<number>(0);
|
|
@@ -86,21 +84,23 @@ export default function useUnstableCollapsibleAppBar(userOptions: Options = defa
|
|
|
86
84
|
|
|
87
85
|
const elevationStyle = useElevationStyle(4);
|
|
88
86
|
const animatedStyle = useAnimatedStyle(() => {
|
|
87
|
+
const transform = [{ translateY: translateY.value }];
|
|
88
|
+
|
|
89
89
|
if (Platform.OS === 'web') {
|
|
90
90
|
return {
|
|
91
|
-
transform
|
|
91
|
+
transform,
|
|
92
92
|
boxShadow: overlapped.value ? elevationStyle?.boxShadow : 0,
|
|
93
93
|
};
|
|
94
94
|
}
|
|
95
95
|
if (Platform.OS === 'android') {
|
|
96
96
|
return {
|
|
97
|
-
transform
|
|
97
|
+
transform,
|
|
98
98
|
elevation: overlapped.value ? elevationStyle?.elevation : 0,
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
101
|
if (Platform.OS === 'ios') {
|
|
102
102
|
return {
|
|
103
|
-
transform
|
|
103
|
+
transform,
|
|
104
104
|
shadowColor: elevationStyle?.shadowColor,
|
|
105
105
|
shadowOffset: elevationStyle?.shadowOffset,
|
|
106
106
|
shadowRadius: elevationStyle?.shadowRadius,
|
|
@@ -108,12 +108,16 @@ export default function useUnstableCollapsibleAppBar(userOptions: Options = defa
|
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
110
|
return {};
|
|
111
|
-
}
|
|
111
|
+
}, [
|
|
112
|
+
/**
|
|
113
|
+
* FIXME: Consider add `elevationStyle` to dependencies.
|
|
114
|
+
*/
|
|
115
|
+
]);
|
|
112
116
|
|
|
113
|
-
const indexRef =
|
|
114
|
-
const offsetsRef =
|
|
117
|
+
const indexRef = useRef<number>(0);
|
|
118
|
+
const offsetsRef = useRef<Array<number>>([]);
|
|
115
119
|
|
|
116
|
-
const onScrollViewChanged = (nextIndex: number) => {
|
|
120
|
+
const onScrollViewChanged = useCallback((nextIndex: number) => {
|
|
117
121
|
const prevIndex = indexRef.current;
|
|
118
122
|
if (prevIndex === nextIndex) {
|
|
119
123
|
if (shouldTranslateYReset) {
|
|
@@ -147,7 +151,7 @@ export default function useUnstableCollapsibleAppBar(userOptions: Options = defa
|
|
|
147
151
|
|
|
148
152
|
vectorY.value = 0;
|
|
149
153
|
}
|
|
150
|
-
};
|
|
154
|
+
}, [appBarHeight]);
|
|
151
155
|
|
|
152
156
|
const scrollHandler = useAnimatedScrollHandler({
|
|
153
157
|
onBeginDrag: () => {
|
|
@@ -218,7 +222,7 @@ export default function useUnstableCollapsibleAppBar(userOptions: Options = defa
|
|
|
218
222
|
duration: ANIMATION_DURATION_MILLIS,
|
|
219
223
|
});
|
|
220
224
|
},
|
|
221
|
-
});
|
|
225
|
+
}, [appBarHeight]);
|
|
222
226
|
|
|
223
227
|
const hasCollapsible = collapsibleToolbarHeight > 0;
|
|
224
228
|
|
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';
|
|
@@ -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,"names":["Carousel","props","autoplay","defaultAutoplay","autoplayInterval","defaultAutoplayInterval","centerSlidePadding","data","inactiveSlideOpacity","defaultInactiveSlideOpacity","inactiveSlideScale","defaultInactiveSlideScale","index","infinite","defaultInfinite","onChange","renderItem","carouselRef","useRef","sliderWidth","setSliderWidth","useState","Dimensions","get","width","itemWidth","undefined","useEffect","carousel","current","currentIndex","snapToItem","handleSnapToItem","newIndex","event","nativeEvent","layout"],"sources":["CarouselNative.tsx"],"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"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAEA;;;;;;;;AAQe,SAASA,QAAT,CAAyBC,KAAzB,EAAsD;EACjE,MAAM;IACFC,QAAQ,GAAGC,sBADT;IAEFC,gBAAgB,GAAGC,8BAFjB;IAGFC,kBAHE;IAIFC,IAJE;IAKFC,oBAAoB,GAAGC,kCALrB;IAMFC,kBAAkB,GAAGC,gCANnB;IAOFC,KAPE;IAQFC,QAAQ,GAAGC,sBART;IASFC,QATE;IAUFC;EAVE,IAWFf,KAXJ;EAaA,MAAMgB,WAAW,GAAG,IAAAC,aAAA,EAAqC,IAArC,CAApB;EAEA,MAAM,CAACC,WAAD,EAAcC,cAAd,IAAgC,IAAAC,eAAA,EAAS,MAAMC,uBAAA,CAAWC,GAAX,CAAe,QAAf,EAAyBC,KAAxC,CAAtC;EAEA,MAAMC,SAAS,GAAGnB,kBAAkB,KAAKoB,SAAvB,GACZP,WAAW,GAAIb,kBAAkB,GAAG,CADxB,GAEZa,WAFN;EAIA,IAAAQ,gBAAA,EAAU,MAAM;IACZ,MAAMC,QAAQ,GAAGX,WAAW,CAACY,OAA7B;;IACA,IAAID,QAAQ,IAAIhB,KAAK,KAAKgB,QAAQ,CAACE,YAAnC,EAAiD;MAC7CF,QAAQ,CAACG,UAAT,CAAoBnB,KAApB,EAA2B,IAA3B;IACH;EACJ,CALD,EAKG,CAACA,KAAD,CALH;;EAOA,MAAMoB,gBAAgB,GAAIC,QAAD,IAAsB;IAC3C,IAAIlB,QAAJ,EAAc;MACVA,QAAQ,CAACkB,QAAD,CAAR;IACH;EACJ,CAJD;;EAMA,oBACI,6BAAC,iBAAD;IAAM,QAAQ,EAAGC,KAAD,IAAWd,cAAc,CAACc,KAAK,CAACC,WAAN,CAAkBC,MAAlB,CAAyBZ,KAA1B;EAAzC,gBACI,6BAAC,gCAAD;IACI,QAAQ,EAAEtB,QADd;IAEI,gBAAgB,EAAEE,gBAFtB;IAGI,IAAI,EAAEG,IAHV;IAII,UAAU,EAAE,IAJhB;IAKI,oBAAoB,EAAEC,oBAL1B;IAMI,kBAAkB,EAAEE,kBANxB;IAOI,SAAS,EAAEe,SAPf;IAQI,IAAI,EAAEZ,QARV;IASI,iBAAiB,EAAE,CATvB;IAUI,YAAY,EAAEmB,gBAVlB;IAWI,GAAG,EAAEf,WAXT;IAYI,UAAU,EAAED,UAZhB;IAaI,WAAW,EAAEG;EAbjB,EADJ,CADJ;AAmBH;;AAAA"}
|