@fountain-ui/lab 2.0.0-beta.1 → 2.0.0-beta.12
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 +1 -1
- package/build/commonjs/BottomSheet/BottomSheetNative.js.map +1 -1
- package/build/commonjs/BottomSheet/BottomSheetProps.js.map +1 -1
- package/build/commonjs/BottomSheet/BottomSheetWeb.js +2 -6
- 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/Carousel/Carousel.js +137 -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 +64 -0
- package/build/commonjs/Carousel/components/ItemView.js.map +1 -0
- package/build/commonjs/Carousel/components/RootView.js +68 -0
- package/build/commonjs/Carousel/components/RootView.js.map +1 -0
- package/build/commonjs/Carousel/components/ScrollViewGesture.js +76 -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/hooks/index.js +64 -0
- package/build/commonjs/Carousel/hooks/index.js.map +1 -0
- package/build/commonjs/Carousel/hooks/useAutoplayController.js +55 -0
- package/build/commonjs/Carousel/hooks/useAutoplayController.js.map +1 -0
- package/build/commonjs/Carousel/hooks/useDimensionChangeReaction.js +23 -0
- package/build/commonjs/Carousel/hooks/useDimensionChangeReaction.js.map +1 -0
- package/build/commonjs/Carousel/hooks/useIndexController.js +70 -0
- package/build/commonjs/Carousel/hooks/useIndexController.js.map +1 -0
- package/build/commonjs/Carousel/hooks/useItemInterpolation.js +63 -0
- package/build/commonjs/Carousel/hooks/useItemInterpolation.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/usePagingAnimation.js +124 -0
- package/build/commonjs/Carousel/hooks/usePagingAnimation.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/types.js +7 -0
- package/build/commonjs/Carousel/types.js.map +1 -0
- package/build/commonjs/ComicViewer/ComicViewer.js +16 -11
- package/build/commonjs/ComicViewer/ComicViewer.js.map +1 -1
- package/build/commonjs/ComicViewer/ComicViewerItemProps.js.map +1 -1
- package/build/commonjs/ComicViewer/ComicViewerProps.js.map +1 -1
- package/build/commonjs/ComicViewer/ViewerItem.js +4 -3
- package/build/commonjs/ComicViewer/ViewerItem.js.map +1 -1
- package/build/commonjs/ComicViewer/index.js.map +1 -1
- package/build/commonjs/DateTimePicker/DateTimePicker.js +2 -2
- 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/ChildrenMemoizedPage.js +86 -21
- package/build/commonjs/ViewPager/ChildrenMemoizedPage.js.map +1 -1
- package/build/commonjs/ViewPager/PageStateContext.js +22 -0
- package/build/commonjs/ViewPager/PageStateContext.js.map +1 -0
- package/build/commonjs/ViewPager/ViewPagerNative.js +61 -38
- package/build/commonjs/ViewPager/ViewPagerNative.js.map +1 -1
- package/build/commonjs/ViewPager/ViewPagerProps.js.map +1 -1
- package/build/commonjs/ViewPager/ViewPagerWeb.js +35 -26
- package/build/commonjs/ViewPager/ViewPagerWeb.js.map +1 -1
- package/build/commonjs/ViewPager/index.js +8 -0
- package/build/commonjs/ViewPager/index.js.map +1 -1
- package/build/commonjs/ViewPager/index.native.js +8 -0
- package/build/commonjs/ViewPager/index.native.js.map +1 -1
- package/build/commonjs/ViewPager/utils.js +5 -39
- 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 +5 -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 +56 -57
- 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 +1 -1
- package/build/module/BottomSheet/BottomSheetNative.js.map +1 -1
- package/build/module/BottomSheet/BottomSheetProps.js.map +1 -1
- package/build/module/BottomSheet/BottomSheetWeb.js +2 -6
- 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/Carousel/Carousel.js +115 -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 +44 -0
- package/build/module/Carousel/components/ItemView.js.map +1 -0
- package/build/module/Carousel/components/RootView.js +47 -0
- package/build/module/Carousel/components/RootView.js.map +1 -0
- package/build/module/Carousel/components/ScrollViewGesture.js +62 -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/hooks/index.js +8 -0
- package/build/module/Carousel/hooks/index.js.map +1 -0
- package/build/module/Carousel/hooks/useAutoplayController.js +45 -0
- package/build/module/Carousel/hooks/useAutoplayController.js.map +1 -0
- package/build/module/Carousel/hooks/useDimensionChangeReaction.js +14 -0
- package/build/module/Carousel/hooks/useDimensionChangeReaction.js.map +1 -0
- package/build/module/Carousel/hooks/useIndexController.js +54 -0
- package/build/module/Carousel/hooks/useIndexController.js.map +1 -0
- package/build/module/Carousel/hooks/useItemInterpolation.js +51 -0
- package/build/module/Carousel/hooks/useItemInterpolation.js.map +1 -0
- package/build/module/Carousel/hooks/useItemVisibilityStore.js +87 -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/usePagingAnimation.js +115 -0
- package/build/module/Carousel/hooks/usePagingAnimation.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/types.js +3 -0
- package/build/module/Carousel/types.js.map +1 -0
- package/build/module/ComicViewer/ComicViewer.js +16 -11
- package/build/module/ComicViewer/ComicViewer.js.map +1 -1
- package/build/module/ComicViewer/ComicViewerItemProps.js.map +1 -1
- package/build/module/ComicViewer/ComicViewerProps.js.map +1 -1
- package/build/module/ComicViewer/ViewerItem.js +4 -3
- package/build/module/ComicViewer/ViewerItem.js.map +1 -1
- package/build/module/ComicViewer/index.js.map +1 -1
- package/build/module/DateTimePicker/DateTimePicker.js +2 -2
- 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/ChildrenMemoizedPage.js +80 -23
- package/build/module/ViewPager/ChildrenMemoizedPage.js.map +1 -1
- package/build/module/ViewPager/PageStateContext.js +10 -0
- package/build/module/ViewPager/PageStateContext.js.map +1 -0
- package/build/module/ViewPager/ViewPagerNative.js +57 -33
- package/build/module/ViewPager/ViewPagerNative.js.map +1 -1
- package/build/module/ViewPager/ViewPagerProps.js.map +1 -1
- package/build/module/ViewPager/ViewPagerWeb.js +29 -24
- package/build/module/ViewPager/ViewPagerWeb.js.map +1 -1
- package/build/module/ViewPager/index.js +1 -0
- package/build/module/ViewPager/index.js.map +1 -1
- package/build/module/ViewPager/index.native.js +1 -0
- package/build/module/ViewPager/index.native.js.map +1 -1
- package/build/module/ViewPager/utils.js +2 -31
- 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 -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 +58 -43
- 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/AnimatedY/AnimatedY.d.ts +0 -1
- package/build/typescript/BottomSheet/BottomSheetNative.d.ts +0 -1
- package/build/typescript/BottomSheet/BottomSheetWeb.d.ts +0 -1
- package/build/typescript/BottomSheet/TransparentBackdrop.d.ts +0 -1
- package/build/typescript/Carousel/Carousel.d.ts +5 -0
- package/build/typescript/Carousel/CarouselProps.d.ts +32 -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 +7 -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/hooks/index.d.ts +7 -0
- package/build/typescript/Carousel/hooks/useAutoplayController.d.ts +7 -0
- package/build/typescript/Carousel/hooks/useDimensionChangeReaction.d.ts +7 -0
- package/build/typescript/Carousel/hooks/useIndexController.d.ts +10 -0
- package/build/typescript/Carousel/hooks/useItemInterpolation.d.ts +2 -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/usePagingAnimation.d.ts +18 -0
- package/build/typescript/Carousel/index.d.ts +3 -1
- package/build/typescript/Carousel/types.d.ts +57 -0
- package/build/typescript/ComicViewer/ComicViewer.d.ts +0 -1
- package/build/typescript/DateTimePicker/DateTimePicker.d.ts +0 -1
- package/build/typescript/DateTimePicker/YearPicker.d.ts +0 -1
- package/build/typescript/FlipCard/FlipCard.d.ts +0 -1
- package/build/typescript/StatusBarProvider/StatusBarProvider.d.ts +0 -1
- package/build/typescript/ViewPager/ChildrenMemoizedPage.d.ts +2 -1
- package/build/typescript/ViewPager/PageStateContext.d.ts +7 -0
- package/build/typescript/ViewPager/ViewPagerNative.d.ts +4 -2
- package/build/typescript/ViewPager/ViewPagerProps.d.ts +31 -19
- package/build/typescript/ViewPager/ViewPagerWeb.d.ts +4 -2
- package/build/typescript/ViewPager/index.d.ts +2 -1
- package/build/typescript/ViewPager/index.native.d.ts +1 -0
- package/build/typescript/ViewPager/utils.d.ts +3 -19
- package/build/typescript/ViewabilityTrackerView/Viewability.d.ts +3 -0
- package/build/typescript/ViewabilityTrackerView/ViewabilityTrackerView.d.ts +2 -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 +12 -27
- package/src/AnimatedY/AnimatedY.tsx +13 -10
- package/src/Carousel/Carousel.tsx +151 -0
- package/src/Carousel/CarouselProps.ts +34 -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 +56 -0
- package/src/Carousel/components/RootView.tsx +66 -0
- package/src/Carousel/components/ScrollViewGesture.tsx +80 -0
- package/src/Carousel/components/index.ts +4 -0
- package/src/Carousel/hooks/index.ts +7 -0
- package/src/Carousel/hooks/useAutoplayController.ts +54 -0
- package/src/Carousel/hooks/useDimensionChangeReaction.ts +25 -0
- package/src/Carousel/hooks/useIndexController.tsx +76 -0
- package/src/Carousel/hooks/useItemInterpolation.ts +107 -0
- package/src/Carousel/hooks/useItemVisibilityStore.ts +107 -0
- package/src/Carousel/hooks/useLoopedData.ts +26 -0
- package/src/Carousel/hooks/usePagingAnimation.ts +148 -0
- package/src/Carousel/index.ts +4 -2
- package/src/Carousel/types.ts +67 -0
- package/src/DateTimePicker/DateTimePicker.tsx +2 -2
- package/src/FlipCard/FlipCard.tsx +8 -8
- package/src/ViewPager/ChildrenMemoizedPage.tsx +97 -23
- package/src/ViewPager/PageStateContext.ts +15 -0
- package/src/ViewPager/ViewPagerNative.tsx +72 -36
- package/src/ViewPager/ViewPagerProps.ts +33 -19
- package/src/ViewPager/ViewPagerWeb.tsx +38 -29
- package/src/ViewPager/index.native.ts +1 -0
- package/src/ViewPager/index.ts +2 -1
- package/src/ViewPager/utils.tsx +4 -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 +56 -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 +2 -2
- package/src/hooks/useIsMounted.ts +19 -0
- package/src/hooks/useUnstableCollapsibleAppBar.ts +59 -42
- package/src/hooks/useUnstableToggleDisplayStyle.ts +8 -6
- 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/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/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/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/hooks/useWidth.ts +0 -17
|
@@ -1,41 +1,46 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import React, { Children, forwardRef, useImperativeHandle, useCallback } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { useSharedValue } from 'react-native-reanimated';
|
|
4
|
+
import { StyleSheet } from '@fountain-ui/core';
|
|
5
|
+
import { defaultInitialPage, defaultLoading, defaultPageComponent } from './utils';
|
|
4
6
|
const styles = StyleSheet.create({
|
|
5
7
|
root: {
|
|
6
8
|
// @ts-ignore
|
|
7
9
|
overflow: 'auto',
|
|
8
10
|
position: 'relative'
|
|
9
|
-
},
|
|
10
|
-
none: {
|
|
11
|
-
display: 'none'
|
|
12
11
|
}
|
|
13
12
|
});
|
|
14
|
-
|
|
13
|
+
const ViewPager = /*#__PURE__*/forwardRef(function ViewPager(props, ref) {
|
|
15
14
|
const {
|
|
16
15
|
children,
|
|
17
|
-
|
|
18
|
-
enableNeighborPageRerender = defaultEnableNeighborPageRerender,
|
|
19
|
-
index,
|
|
16
|
+
initialPage = defaultInitialPage,
|
|
20
17
|
loading = defaultLoading,
|
|
21
18
|
pageComponent = defaultPageComponent,
|
|
22
19
|
pageForceRerenderKey,
|
|
23
|
-
style
|
|
20
|
+
style,
|
|
21
|
+
UNSTABLE_sharedIndex
|
|
24
22
|
} = props;
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
});
|
|
23
|
+
const fallbackSharedIndex = useSharedValue(initialPage);
|
|
24
|
+
const sharedIndex = UNSTABLE_sharedIndex ?? fallbackSharedIndex;
|
|
25
|
+
const setPage = useCallback(newIndex => {
|
|
26
|
+
sharedIndex.value = newIndex;
|
|
27
|
+
}, [sharedIndex]);
|
|
28
|
+
useImperativeHandle(ref, () => ({
|
|
29
|
+
setPage
|
|
30
|
+
}), [setPage]);
|
|
31
|
+
const PageComponent = pageComponent;
|
|
33
32
|
return /*#__PURE__*/React.createElement(View, {
|
|
34
33
|
style: [styles.root, style]
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
}, Children.map(children, (child, index) => /*#__PURE__*/React.createElement(PageComponent, {
|
|
35
|
+
key: index,
|
|
36
|
+
children: child,
|
|
37
|
+
index: index,
|
|
38
|
+
loading: loading,
|
|
39
|
+
offscreenPageRerenderLimit: 0 // All offscreen pages will not be re-rendered
|
|
40
|
+
,
|
|
41
|
+
rerenderKey: pageForceRerenderKey,
|
|
42
|
+
sharedIndex: sharedIndex
|
|
38
43
|
})));
|
|
39
|
-
}
|
|
40
|
-
;
|
|
44
|
+
});
|
|
45
|
+
export default ViewPager;
|
|
41
46
|
//# sourceMappingURL=ViewPagerWeb.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["React","Children","forwardRef","useImperativeHandle","useCallback","View","useSharedValue","StyleSheet","defaultInitialPage","defaultLoading","defaultPageComponent","styles","create","root","overflow","position","ViewPager","props","ref","children","initialPage","loading","pageComponent","pageForceRerenderKey","style","UNSTABLE_sharedIndex","fallbackSharedIndex","sharedIndex","setPage","newIndex","value","PageComponent","map","child","index"],"sources":["ViewPagerWeb.tsx"],"sourcesContent":["import React, { Children, forwardRef, useImperativeHandle, useCallback } from 'react';\nimport { View } from 'react-native';\nimport { useSharedValue } from 'react-native-reanimated';\nimport { StyleSheet } from '@fountain-ui/core';\nimport type ViewPagerProps from './ViewPagerProps';\nimport type { ViewPagerInstance } from './ViewPagerProps';\nimport { defaultInitialPage, defaultLoading, defaultPageComponent } from './utils';\n\nconst styles = StyleSheet.create({\n root: {\n // @ts-ignore\n overflow: 'auto',\n position: 'relative',\n },\n});\n\nconst ViewPager = forwardRef<ViewPagerInstance, ViewPagerProps>(function ViewPager(props, ref) {\n const {\n children,\n initialPage = defaultInitialPage,\n loading = defaultLoading,\n pageComponent = defaultPageComponent,\n pageForceRerenderKey,\n style,\n UNSTABLE_sharedIndex,\n } = props;\n\n const fallbackSharedIndex = useSharedValue<number>(initialPage);\n\n const sharedIndex = UNSTABLE_sharedIndex ?? fallbackSharedIndex;\n\n const setPage = useCallback((newIndex: number) => {\n sharedIndex.value = newIndex;\n }, [sharedIndex]);\n\n useImperativeHandle(\n ref,\n () => ({ setPage }),\n [setPage],\n );\n\n const PageComponent = pageComponent;\n\n return (\n <View style={[styles.root, style]}>\n {Children.map(children, (child, index) => (\n <PageComponent\n key={index}\n children={child}\n index={index}\n loading={loading}\n offscreenPageRerenderLimit={0} // All offscreen pages will not be re-rendered\n rerenderKey={pageForceRerenderKey}\n sharedIndex={sharedIndex}\n />\n ))}\n </View>\n );\n});\n\nexport default ViewPager;\n"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,UAA1B,EAAsCC,mBAAtC,EAA2DC,WAA3D,QAA8E,OAA9E;AACA,SAASC,IAAT,QAAqB,cAArB;AACA,SAASC,cAAT,QAA+B,yBAA/B;AACA,SAASC,UAAT,QAA2B,mBAA3B;AAGA,SAASC,kBAAT,EAA6BC,cAA7B,EAA6CC,oBAA7C,QAAyE,SAAzE;AAEA,MAAMC,MAAM,GAAGJ,UAAU,CAACK,MAAX,CAAkB;EAC7BC,IAAI,EAAE;IACF;IACAC,QAAQ,EAAE,MAFR;IAGFC,QAAQ,EAAE;EAHR;AADuB,CAAlB,CAAf;AAQA,MAAMC,SAAS,gBAAGd,UAAU,CAAoC,SAASc,SAAT,CAAmBC,KAAnB,EAA0BC,GAA1B,EAA+B;EAC3F,MAAM;IACFC,QADE;IAEFC,WAAW,GAAGZ,kBAFZ;IAGFa,OAAO,GAAGZ,cAHR;IAIFa,aAAa,GAAGZ,oBAJd;IAKFa,oBALE;IAMFC,KANE;IAOFC;EAPE,IAQFR,KARJ;EAUA,MAAMS,mBAAmB,GAAGpB,cAAc,CAASc,WAAT,CAA1C;EAEA,MAAMO,WAAW,GAAGF,oBAAoB,IAAIC,mBAA5C;EAEA,MAAME,OAAO,GAAGxB,WAAW,CAAEyB,QAAD,IAAsB;IAC9CF,WAAW,CAACG,KAAZ,GAAoBD,QAApB;EACH,CAF0B,EAExB,CAACF,WAAD,CAFwB,CAA3B;EAIAxB,mBAAmB,CACfe,GADe,EAEf,OAAO;IAAEU;EAAF,CAAP,CAFe,EAGf,CAACA,OAAD,CAHe,CAAnB;EAMA,MAAMG,aAAa,GAAGT,aAAtB;EAEA,oBACI,oBAAC,IAAD;IAAM,KAAK,EAAE,CAACX,MAAM,CAACE,IAAR,EAAcW,KAAd;EAAb,GACKvB,QAAQ,CAAC+B,GAAT,CAAab,QAAb,EAAuB,CAACc,KAAD,EAAQC,KAAR,kBACpB,oBAAC,aAAD;IACI,GAAG,EAAEA,KADT;IAEI,QAAQ,EAAED,KAFd;IAGI,KAAK,EAAEC,KAHX;IAII,OAAO,EAAEb,OAJb;IAKI,0BAA0B,EAAE,CALhC,CAKmC;IALnC;IAMI,WAAW,EAAEE,oBANjB;IAOI,WAAW,EAAEI;EAPjB,EADH,CADL,CADJ;AAeH,CA1C2B,CAA5B;AA4CA,eAAeX,SAAf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["default","useViewPagerPageState"],"sources":["index.ts"],"sourcesContent":["export { default } from './ViewPagerWeb';\nexport type { default as ViewPagerProps, ViewPagerInstance } from './ViewPagerProps';\nexport { useViewPagerPageState } from './PageStateContext';\n"],"mappings":"AAAA,SAASA,OAAT,QAAwB,gBAAxB;AAEA,SAASC,qBAAT,QAAsC,oBAAtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["default","useViewPagerPageState"],"sources":["index.native.ts"],"sourcesContent":["export { default } from './ViewPagerNative';\nexport { useViewPagerPageState } from './PageStateContext';\n"],"mappings":"AAAA,SAASA,OAAT,QAAwB,mBAAxB;AACA,SAASC,qBAAT,QAAsC,oBAAtC"}
|
|
@@ -1,35 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import ChildrenMemoizedPage from './ChildrenMemoizedPage';
|
|
3
|
-
export const
|
|
4
|
-
export const defaultEnableNeighborPageRerender = false;
|
|
2
|
+
export const defaultInitialPage = 0;
|
|
5
3
|
export const defaultLoading = 'lazy';
|
|
4
|
+
export const defaultOffscreenPageRerenderLimit = 0;
|
|
6
5
|
export const defaultPageComponent = ChildrenMemoizedPage;
|
|
7
|
-
export const usePageRenderer = ({
|
|
8
|
-
enableVisibleHint,
|
|
9
|
-
index: currentIndex,
|
|
10
|
-
loading,
|
|
11
|
-
pageComponent: PageComponent,
|
|
12
|
-
pageForceRerenderKey,
|
|
13
|
-
enableNeighborPageRerender
|
|
14
|
-
}) => {
|
|
15
|
-
const pagesStateRef = React.useRef([]);
|
|
16
|
-
pagesStateRef.current[currentIndex] = { ...pagesStateRef.current[currentIndex],
|
|
17
|
-
visited: true
|
|
18
|
-
};
|
|
19
|
-
return children => React.Children.map(children, (child, index) => {
|
|
20
|
-
var _pagesStateRef$curren, _pagesStateRef$curren2;
|
|
21
|
-
|
|
22
|
-
const visited = (_pagesStateRef$curren = (_pagesStateRef$curren2 = pagesStateRef.current[index]) === null || _pagesStateRef$curren2 === void 0 ? void 0 : _pagesStateRef$curren2.visited) !== null && _pagesStateRef$curren !== void 0 ? _pagesStateRef$curren : false;
|
|
23
|
-
const content = loading === 'eager' || visited ? child : null;
|
|
24
|
-
const isVisible = enableVisibleHint ? index === currentIndex : false;
|
|
25
|
-
const isNeighborIndex = index === currentIndex - 1 || index === currentIndex + 1;
|
|
26
|
-
return /*#__PURE__*/React.createElement(PageComponent, {
|
|
27
|
-
key: index,
|
|
28
|
-
children: content,
|
|
29
|
-
isNeighbor: enableNeighborPageRerender && isNeighborIndex,
|
|
30
|
-
isVisible: isVisible,
|
|
31
|
-
rerenderKey: pageForceRerenderKey
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
6
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["ChildrenMemoizedPage","defaultInitialPage","defaultLoading","defaultOffscreenPageRerenderLimit","defaultPageComponent"],"sources":["utils.tsx"],"sourcesContent":["import { Loading, PageComponent } from './ViewPagerProps';\nimport ChildrenMemoizedPage from './ChildrenMemoizedPage';\n\nexport const defaultInitialPage: number = 0;\n\nexport const defaultLoading: Loading = 'lazy';\n\nexport const defaultOffscreenPageRerenderLimit: number = 0;\n\nexport const defaultPageComponent: PageComponent = ChildrenMemoizedPage;\n"],"mappings":"AACA,OAAOA,oBAAP,MAAiC,wBAAjC;AAEA,OAAO,MAAMC,kBAA0B,GAAG,CAAnC;AAEP,OAAO,MAAMC,cAAuB,GAAG,MAAhC;AAEP,OAAO,MAAMC,iCAAyC,GAAG,CAAlD;AAEP,OAAO,MAAMC,oBAAmC,GAAGJ,oBAA5C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["Viewability.ts"],"sourcesContent":["export default interface Viewability {\n visible: boolean;\n}\n"],"mappings":""}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
3
|
+
import React, { useRef } from 'react';
|
|
4
|
+
import { View } from 'react-native';
|
|
5
|
+
import useViewabilityTracker from './useViewabilityTracker';
|
|
6
|
+
export default function ViewabilityTrackerView(props) {
|
|
7
|
+
const {
|
|
8
|
+
enabled = true,
|
|
9
|
+
measurementIntervalMillis = 1000,
|
|
10
|
+
onViewabilityChange,
|
|
11
|
+
visiblePercentThreshold = 50,
|
|
12
|
+
...otherProps
|
|
13
|
+
} = props;
|
|
14
|
+
const viewRef = useRef(null);
|
|
15
|
+
useViewabilityTracker({
|
|
16
|
+
enabled,
|
|
17
|
+
measurementIntervalMillis,
|
|
18
|
+
onViewabilityChange,
|
|
19
|
+
viewRef,
|
|
20
|
+
visiblePercentThreshold
|
|
21
|
+
});
|
|
22
|
+
return /*#__PURE__*/React.createElement(View, _extends({}, otherProps, {
|
|
23
|
+
ref: viewRef,
|
|
24
|
+
collapsable: false
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
;
|
|
28
|
+
//# sourceMappingURL=ViewabilityTrackerView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useRef","View","useViewabilityTracker","ViewabilityTrackerView","props","enabled","measurementIntervalMillis","onViewabilityChange","visiblePercentThreshold","otherProps","viewRef"],"sources":["ViewabilityTrackerView.tsx"],"sourcesContent":["import React, { useRef } from 'react';\nimport { View } from 'react-native';\nimport useViewabilityTracker from './useViewabilityTracker';\nimport type ViewabilityTrackerViewProps from './ViewabilityTrackerViewProps';\n\n\nexport default function ViewabilityTrackerView(props: ViewabilityTrackerViewProps) {\n const {\n enabled = true,\n measurementIntervalMillis = 1000,\n onViewabilityChange,\n visiblePercentThreshold = 50,\n ...otherProps\n } = props;\n\n const viewRef = useRef<View>(null);\n\n useViewabilityTracker({\n enabled,\n measurementIntervalMillis,\n onViewabilityChange,\n viewRef,\n visiblePercentThreshold,\n });\n\n return (\n <View\n {...otherProps}\n ref={viewRef}\n collapsable={false}\n />\n );\n};\n"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,MAAhB,QAA8B,OAA9B;AACA,SAASC,IAAT,QAAqB,cAArB;AACA,OAAOC,qBAAP,MAAkC,yBAAlC;AAIA,eAAe,SAASC,sBAAT,CAAgCC,KAAhC,EAAoE;EAC/E,MAAM;IACFC,OAAO,GAAG,IADR;IAEFC,yBAAyB,GAAG,IAF1B;IAGFC,mBAHE;IAIFC,uBAAuB,GAAG,EAJxB;IAKF,GAAGC;EALD,IAMFL,KANJ;EAQA,MAAMM,OAAO,GAAGV,MAAM,CAAO,IAAP,CAAtB;EAEAE,qBAAqB,CAAC;IAClBG,OADkB;IAElBC,yBAFkB;IAGlBC,mBAHkB;IAIlBG,OAJkB;IAKlBF;EALkB,CAAD,CAArB;EAQA,oBACI,oBAAC,IAAD,eACQC,UADR;IAEI,GAAG,EAAEC,OAFT;IAGI,WAAW,EAAE;EAHjB,GADJ;AAOH;AAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["ViewabilityTrackerViewProps.ts"],"sourcesContent":["import type { ViewProps } from 'react-native';\nimport type { OverridableComponentProps } from '@fountain-ui/core';\nimport type Viewability from './Viewability';\n\nexport default interface ViewabilityTrackerViewProps extends OverridableComponentProps<ViewProps, {\n /**\n * @default true\n */\n enabled?: boolean;\n\n /**\n * @default 1000\n */\n measurementIntervalMillis?: number;\n\n /**\n *\n */\n onViewabilityChange?: (viewability: Viewability) => void;\n\n /**\n * @default 50\n */\n visiblePercentThreshold?: number;\n}> {}\n"],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["default"],"sources":["index.ts"],"sourcesContent":["export { default } from './ViewabilityTrackerView';\nexport type { default as ViewabilityTrackerViewProps } from './ViewabilityTrackerViewProps';\n"],"mappings":"AAAA,SAASA,OAAT,QAAwB,0BAAxB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const computeRectSize = rect => (rect.bottom - rect.top) * (rect.right - rect.left);
|
|
2
|
+
|
|
3
|
+
const normalizePagePosition = value => value != null && Number.isFinite(value) ? value : Number.MAX_SAFE_INTEGER;
|
|
4
|
+
|
|
5
|
+
const normalizeViewSize = size => Number.isFinite(size) && size > 0 ? size : Number.MAX_SAFE_INTEGER;
|
|
6
|
+
|
|
7
|
+
const clamp = (value, min, max) => Math.min(Math.max(value, min), max);
|
|
8
|
+
|
|
9
|
+
export default function measureViewability(_ref) {
|
|
10
|
+
let {
|
|
11
|
+
view,
|
|
12
|
+
windowWidth,
|
|
13
|
+
windowHeight,
|
|
14
|
+
onViewabilityDetailMeasured
|
|
15
|
+
} = _ref;
|
|
16
|
+
view.measure((x, y, width, height, pageX, pageY) => {
|
|
17
|
+
const safePageX = normalizePagePosition(pageX);
|
|
18
|
+
const safePageY = normalizePagePosition(pageY);
|
|
19
|
+
const visibleRect = {
|
|
20
|
+
top: clamp(safePageY, 0, windowHeight),
|
|
21
|
+
bottom: clamp(safePageY + height, 0, windowHeight),
|
|
22
|
+
left: clamp(safePageX, 0, windowWidth),
|
|
23
|
+
right: clamp(safePageX + width, 0, windowWidth)
|
|
24
|
+
};
|
|
25
|
+
const visibleRectSize = computeRectSize(visibleRect);
|
|
26
|
+
const viewSize = normalizeViewSize(width * height);
|
|
27
|
+
const visiblePercent = Math.round(visibleRectSize / viewSize * 100);
|
|
28
|
+
onViewabilityDetailMeasured === null || onViewabilityDetailMeasured === void 0 ? void 0 : onViewabilityDetailMeasured({
|
|
29
|
+
visiblePercent
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
;
|
|
34
|
+
//# sourceMappingURL=measureViewability.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["computeRectSize","rect","bottom","top","right","left","normalizePagePosition","value","Number","isFinite","MAX_SAFE_INTEGER","normalizeViewSize","size","clamp","min","max","Math","measureViewability","view","windowWidth","windowHeight","onViewabilityDetailMeasured","measure","x","y","width","height","pageX","pageY","safePageX","safePageY","visibleRect","visibleRectSize","viewSize","visiblePercent","round"],"sources":["measureViewability.ts"],"sourcesContent":["import type { View } from 'react-native';\n\ninterface Rect {\n top: number,\n bottom: number;\n left: number;\n right: number;\n}\n\nexport interface ViewabilityDetail {\n visiblePercent: number;\n}\n\nexport interface MeasureViewabilityParameters {\n view: View;\n windowWidth: number;\n windowHeight: number;\n onViewabilityDetailMeasured: (detail: ViewabilityDetail) => void;\n}\n\nconst computeRectSize = (rect: Rect): number =>\n (rect.bottom - rect.top) * (rect.right - rect.left);\n\nconst normalizePagePosition = (value?: number): number =>\n (value != null && Number.isFinite(value)) ? value : Number.MAX_SAFE_INTEGER;\n\nconst normalizeViewSize = (size: number): number =>\n Number.isFinite(size) && size > 0 ? size : Number.MAX_SAFE_INTEGER;\n\nconst clamp = (value: number, min: number, max: number): number =>\n Math.min(Math.max(value, min), max);\n\nexport default function measureViewability({\n view,\n windowWidth,\n windowHeight,\n onViewabilityDetailMeasured,\n}: MeasureViewabilityParameters) {\n view.measure((x, y, width, height, pageX?: number, pageY?: number) => {\n const safePageX = normalizePagePosition(pageX);\n const safePageY = normalizePagePosition(pageY);\n\n const visibleRect: Rect = {\n top: clamp(safePageY, 0, windowHeight),\n bottom: clamp(safePageY + height, 0, windowHeight),\n left: clamp(safePageX, 0, windowWidth),\n right: clamp(safePageX + width, 0, windowWidth),\n };\n\n const visibleRectSize = computeRectSize(visibleRect);\n const viewSize = normalizeViewSize(width * height);\n const visiblePercent = Math.round(visibleRectSize / viewSize * 100);\n\n onViewabilityDetailMeasured?.({ visiblePercent });\n });\n};\n"],"mappings":"AAoBA,MAAMA,eAAe,GAAIC,IAAD,IACpB,CAACA,IAAI,CAACC,MAAL,GAAcD,IAAI,CAACE,GAApB,KAA4BF,IAAI,CAACG,KAAL,GAAaH,IAAI,CAACI,IAA9C,CADJ;;AAGA,MAAMC,qBAAqB,GAAIC,KAAD,IACzBA,KAAK,IAAI,IAAT,IAAiBC,MAAM,CAACC,QAAP,CAAgBF,KAAhB,CAAlB,GAA4CA,KAA5C,GAAoDC,MAAM,CAACE,gBAD/D;;AAGA,MAAMC,iBAAiB,GAAIC,IAAD,IACtBJ,MAAM,CAACC,QAAP,CAAgBG,IAAhB,KAAyBA,IAAI,GAAG,CAAhC,GAAoCA,IAApC,GAA2CJ,MAAM,CAACE,gBADtD;;AAGA,MAAMG,KAAK,GAAG,CAACN,KAAD,EAAgBO,GAAhB,EAA6BC,GAA7B,KACVC,IAAI,CAACF,GAAL,CAASE,IAAI,CAACD,GAAL,CAASR,KAAT,EAAgBO,GAAhB,CAAT,EAA+BC,GAA/B,CADJ;;AAGA,eAAe,SAASE,kBAAT,OAKkB;EAAA,IALU;IACvCC,IADuC;IAEvCC,WAFuC;IAGvCC,YAHuC;IAIvCC;EAJuC,CAKV;EAC7BH,IAAI,CAACI,OAAL,CAAa,CAACC,CAAD,EAAIC,CAAJ,EAAOC,KAAP,EAAcC,MAAd,EAAsBC,KAAtB,EAAsCC,KAAtC,KAAyD;IAClE,MAAMC,SAAS,GAAGvB,qBAAqB,CAACqB,KAAD,CAAvC;IACA,MAAMG,SAAS,GAAGxB,qBAAqB,CAACsB,KAAD,CAAvC;IAEA,MAAMG,WAAiB,GAAG;MACtB5B,GAAG,EAAEU,KAAK,CAACiB,SAAD,EAAY,CAAZ,EAAeV,YAAf,CADY;MAEtBlB,MAAM,EAAEW,KAAK,CAACiB,SAAS,GAAGJ,MAAb,EAAqB,CAArB,EAAwBN,YAAxB,CAFS;MAGtBf,IAAI,EAAEQ,KAAK,CAACgB,SAAD,EAAY,CAAZ,EAAeV,WAAf,CAHW;MAItBf,KAAK,EAAES,KAAK,CAACgB,SAAS,GAAGJ,KAAb,EAAoB,CAApB,EAAuBN,WAAvB;IAJU,CAA1B;IAOA,MAAMa,eAAe,GAAGhC,eAAe,CAAC+B,WAAD,CAAvC;IACA,MAAME,QAAQ,GAAGtB,iBAAiB,CAACc,KAAK,GAAGC,MAAT,CAAlC;IACA,MAAMQ,cAAc,GAAGlB,IAAI,CAACmB,KAAL,CAAWH,eAAe,GAAGC,QAAlB,GAA6B,GAAxC,CAAvB;IAEAZ,2BAA2B,SAA3B,IAAAA,2BAA2B,WAA3B,YAAAA,2BAA2B,CAAG;MAAEa;IAAF,CAAH,CAA3B;EACH,CAhBD;AAiBH;AAAA"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
import { useValidWindowDimensions } from '@fountain-ui/core';
|
|
3
|
+
import { useDeferredExecutor } from '../hooks';
|
|
4
|
+
import measureViewability from './measureViewability';
|
|
5
|
+
const initialViewability = {
|
|
6
|
+
visible: false
|
|
7
|
+
};
|
|
8
|
+
export default function useViewabilityTracker(config) {
|
|
9
|
+
const {
|
|
10
|
+
enabled,
|
|
11
|
+
measurementIntervalMillis,
|
|
12
|
+
onViewabilityChange,
|
|
13
|
+
viewRef,
|
|
14
|
+
visiblePercentThreshold
|
|
15
|
+
} = config;
|
|
16
|
+
const viewabilityRef = useRef(initialViewability);
|
|
17
|
+
const executor = useDeferredExecutor();
|
|
18
|
+
const window = useValidWindowDimensions();
|
|
19
|
+
|
|
20
|
+
const maybeMeasureRecursive = () => {
|
|
21
|
+
if (!enabled) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const mapViewabilityDetailToViewability = detail => {
|
|
26
|
+
return {
|
|
27
|
+
visible: detail.visiblePercent >= visiblePercentThreshold
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const isViewabilityEquals = (a, b) => {
|
|
32
|
+
return a.visible === b.visible;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const dispatchViewabilityChanged = viewability => {
|
|
36
|
+
executor.execute(() => onViewabilityChange === null || onViewabilityChange === void 0 ? void 0 : onViewabilityChange(viewability));
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const onViewabilityDetailMeasured = detail => {
|
|
40
|
+
const nextViewability = mapViewabilityDetailToViewability(detail);
|
|
41
|
+
|
|
42
|
+
if (!isViewabilityEquals(viewabilityRef.current, nextViewability)) {
|
|
43
|
+
viewabilityRef.current = nextViewability;
|
|
44
|
+
dispatchViewabilityChanged(nextViewability);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
maybeMeasureRecursive();
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const maybeMeasure = () => {
|
|
51
|
+
if (viewRef.current) {
|
|
52
|
+
measureViewability({
|
|
53
|
+
view: viewRef.current,
|
|
54
|
+
windowWidth: window.width,
|
|
55
|
+
windowHeight: window.height,
|
|
56
|
+
onViewabilityDetailMeasured
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
executor.execute(maybeMeasure, measurementIntervalMillis);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
if (enabled) {
|
|
66
|
+
maybeMeasureRecursive();
|
|
67
|
+
} else {
|
|
68
|
+
executor.cancel();
|
|
69
|
+
}
|
|
70
|
+
}, [enabled]);
|
|
71
|
+
}
|
|
72
|
+
;
|
|
73
|
+
//# sourceMappingURL=useViewabilityTracker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","useRef","useValidWindowDimensions","useDeferredExecutor","measureViewability","initialViewability","visible","useViewabilityTracker","config","enabled","measurementIntervalMillis","onViewabilityChange","viewRef","visiblePercentThreshold","viewabilityRef","executor","window","maybeMeasureRecursive","mapViewabilityDetailToViewability","detail","visiblePercent","isViewabilityEquals","a","b","dispatchViewabilityChanged","viewability","execute","onViewabilityDetailMeasured","nextViewability","current","maybeMeasure","view","windowWidth","width","windowHeight","height","cancel"],"sources":["useViewabilityTracker.ts"],"sourcesContent":["import type { RefObject } from 'react';\nimport { useEffect, useRef } from 'react';\nimport type { View } from 'react-native';\nimport { useValidWindowDimensions } from '@fountain-ui/core';\nimport { useDeferredExecutor } from '../hooks';\nimport type { ViewabilityDetail } from './measureViewability';\nimport measureViewability from './measureViewability';\nimport type Viewability from './Viewability';\n\nexport interface ViewabilityTrackerConfig {\n enabled: boolean;\n measurementIntervalMillis: number;\n onViewabilityChange?: (viewability: Viewability) => void;\n viewRef: RefObject<View>;\n visiblePercentThreshold: number;\n}\n\nconst initialViewability: Readonly<Viewability> = { visible: false };\n\nexport default function useViewabilityTracker(config: ViewabilityTrackerConfig) {\n const {\n enabled,\n measurementIntervalMillis,\n onViewabilityChange,\n viewRef,\n visiblePercentThreshold,\n } = config;\n\n const viewabilityRef = useRef<Viewability>(initialViewability);\n\n const executor = useDeferredExecutor();\n\n const window = useValidWindowDimensions();\n\n const maybeMeasureRecursive = () => {\n if (!enabled) {\n return;\n }\n\n const mapViewabilityDetailToViewability = (detail: ViewabilityDetail): Viewability => {\n return { visible: detail.visiblePercent >= visiblePercentThreshold };\n };\n\n const isViewabilityEquals = (a: Viewability, b: Viewability): boolean => {\n return a.visible === b.visible;\n };\n\n const dispatchViewabilityChanged = (viewability: Viewability) => {\n executor.execute(() => onViewabilityChange?.(viewability));\n };\n\n const onViewabilityDetailMeasured = (detail: ViewabilityDetail) => {\n const nextViewability = mapViewabilityDetailToViewability(detail);\n\n if (!isViewabilityEquals(viewabilityRef.current, nextViewability)) {\n viewabilityRef.current = nextViewability;\n\n dispatchViewabilityChanged(nextViewability);\n }\n\n maybeMeasureRecursive();\n };\n\n const maybeMeasure = () => {\n if (viewRef.current) {\n measureViewability({\n view: viewRef.current,\n windowWidth: window.width,\n windowHeight: window.height,\n onViewabilityDetailMeasured,\n });\n }\n };\n\n executor.execute(maybeMeasure, measurementIntervalMillis);\n };\n\n useEffect(() => {\n if (enabled) {\n maybeMeasureRecursive();\n } else {\n executor.cancel();\n }\n }, [enabled]);\n};\n"],"mappings":"AACA,SAASA,SAAT,EAAoBC,MAApB,QAAkC,OAAlC;AAEA,SAASC,wBAAT,QAAyC,mBAAzC;AACA,SAASC,mBAAT,QAAoC,UAApC;AAEA,OAAOC,kBAAP,MAA+B,sBAA/B;AAWA,MAAMC,kBAAyC,GAAG;EAAEC,OAAO,EAAE;AAAX,CAAlD;AAEA,eAAe,SAASC,qBAAT,CAA+BC,MAA/B,EAAiE;EAC5E,MAAM;IACFC,OADE;IAEFC,yBAFE;IAGFC,mBAHE;IAIFC,OAJE;IAKFC;EALE,IAMFL,MANJ;EAQA,MAAMM,cAAc,GAAGb,MAAM,CAAcI,kBAAd,CAA7B;EAEA,MAAMU,QAAQ,GAAGZ,mBAAmB,EAApC;EAEA,MAAMa,MAAM,GAAGd,wBAAwB,EAAvC;;EAEA,MAAMe,qBAAqB,GAAG,MAAM;IAChC,IAAI,CAACR,OAAL,EAAc;MACV;IACH;;IAED,MAAMS,iCAAiC,GAAIC,MAAD,IAA4C;MAClF,OAAO;QAAEb,OAAO,EAAEa,MAAM,CAACC,cAAP,IAAyBP;MAApC,CAAP;IACH,CAFD;;IAIA,MAAMQ,mBAAmB,GAAG,CAACC,CAAD,EAAiBC,CAAjB,KAA6C;MACrE,OAAOD,CAAC,CAAChB,OAAF,KAAciB,CAAC,CAACjB,OAAvB;IACH,CAFD;;IAIA,MAAMkB,0BAA0B,GAAIC,WAAD,IAA8B;MAC7DV,QAAQ,CAACW,OAAT,CAAiB,MAAMf,mBAAN,aAAMA,mBAAN,uBAAMA,mBAAmB,CAAGc,WAAH,CAA1C;IACH,CAFD;;IAIA,MAAME,2BAA2B,GAAIR,MAAD,IAA+B;MAC/D,MAAMS,eAAe,GAAGV,iCAAiC,CAACC,MAAD,CAAzD;;MAEA,IAAI,CAACE,mBAAmB,CAACP,cAAc,CAACe,OAAhB,EAAyBD,eAAzB,CAAxB,EAAmE;QAC/Dd,cAAc,CAACe,OAAf,GAAyBD,eAAzB;QAEAJ,0BAA0B,CAACI,eAAD,CAA1B;MACH;;MAEDX,qBAAqB;IACxB,CAVD;;IAYA,MAAMa,YAAY,GAAG,MAAM;MACvB,IAAIlB,OAAO,CAACiB,OAAZ,EAAqB;QACjBzB,kBAAkB,CAAC;UACf2B,IAAI,EAAEnB,OAAO,CAACiB,OADC;UAEfG,WAAW,EAAEhB,MAAM,CAACiB,KAFL;UAGfC,YAAY,EAAElB,MAAM,CAACmB,MAHN;UAIfR;QAJe,CAAD,CAAlB;MAMH;IACJ,CATD;;IAWAZ,QAAQ,CAACW,OAAT,CAAiBI,YAAjB,EAA+BpB,yBAA/B;EACH,CAzCD;;EA2CAV,SAAS,CAAC,MAAM;IACZ,IAAIS,OAAJ,EAAa;MACTQ,qBAAqB;IACxB,CAFD,MAEO;MACHF,QAAQ,CAACqB,MAAT;IACH;EACJ,CANQ,EAMN,CAAC3B,OAAD,CANM,CAAT;AAOH;AAAA"}
|
|
@@ -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
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["default","useDeferredExecutor","useIsMounted","useUnstableCollapsibleAppBar","useUnstableToggleDisplayStyle"],"sources":["index.ts"],"sourcesContent":["export { default as useDeferredExecutor } from './useDeferredExecutor';\nexport { default as useIsMounted } from './useIsMounted';\nexport { default as useUnstableCollapsibleAppBar } from './useUnstableCollapsibleAppBar';\nexport { default as useUnstableToggleDisplayStyle } from './useUnstableToggleDisplayStyle';\n\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,mBAApB,QAA+C,uBAA/C;AACA,SAASD,OAAO,IAAIE,YAApB,QAAwC,gBAAxC;AACA,SAASF,OAAO,IAAIG,4BAApB,QAAwD,gCAAxD;AACA,SAASH,OAAO,IAAII,6BAApB,QAAyD,iCAAzD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["useAppBarStyles","floating","position","top","left","right"],"sources":["useAppbarStyles.ts"],"sourcesContent":["import { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\n\ntype AppBarStyles = NamedStylesStringUnion<'floating'>;\n\nconst useAppBarStyles: UseStyles<AppBarStyles> = function (): AppBarStyles {\n return {\n floating: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n },\n };\n};\n\nexport default useAppBarStyles;"],"mappings":"AAIA,MAAMA,eAAwC,GAAG,YAA0B;EACvE,OAAO;IACHC,QAAQ,EAAE;MACNC,QAAQ,EAAE,UADJ;MAENC,GAAG,EAAE,CAFC;MAGNC,IAAI,EAAE,CAHA;MAINC,KAAK,EAAE;IAJD;EADP,CAAP;AAQH,CATD;;AAWA,eAAeL,eAAf"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
2
|
+
import useIsMounted from './useIsMounted';
|
|
3
|
+
export default function useDeferredExecutor() {
|
|
4
|
+
const isMounted = useIsMounted();
|
|
5
|
+
const timeoutIdRef = useRef(null);
|
|
6
|
+
const cancel = useCallback(() => {
|
|
7
|
+
if (timeoutIdRef.current) {
|
|
8
|
+
clearTimeout(timeoutIdRef.current);
|
|
9
|
+
}
|
|
10
|
+
}, []);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
return cancel;
|
|
13
|
+
}, []);
|
|
14
|
+
const execute = useCallback((runnable, delay) => {
|
|
15
|
+
if (!isMounted()) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
cancel();
|
|
20
|
+
|
|
21
|
+
if (Number.isFinite(delay)) {
|
|
22
|
+
timeoutIdRef.current = setTimeout(() => runnable(), delay);
|
|
23
|
+
} else {
|
|
24
|
+
runnable();
|
|
25
|
+
}
|
|
26
|
+
}, []);
|
|
27
|
+
return {
|
|
28
|
+
cancel,
|
|
29
|
+
execute
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
;
|
|
33
|
+
//# sourceMappingURL=useDeferredExecutor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useCallback","useEffect","useRef","useIsMounted","useDeferredExecutor","isMounted","timeoutIdRef","cancel","current","clearTimeout","execute","runnable","delay","Number","isFinite","setTimeout"],"sources":["useDeferredExecutor.ts"],"sourcesContent":["import { useCallback, useEffect, useRef } from 'react';\nimport useIsMounted from './useIsMounted';\n\nexport interface Runnable {\n (): void;\n}\n\nexport interface DeferredExecute {\n (runnable: Runnable, delay?: number): void;\n}\n\nexport interface DeferredExecutor {\n cancel: () => void;\n execute: DeferredExecute;\n}\n\nexport default function useDeferredExecutor(): DeferredExecutor {\n const isMounted = useIsMounted();\n const timeoutIdRef = useRef<NodeJS.Timer | null>(null);\n\n const cancel = useCallback(() => {\n if (timeoutIdRef.current) {\n clearTimeout(timeoutIdRef.current);\n }\n }, []);\n\n useEffect(() => {\n return cancel;\n }, []);\n\n const execute = useCallback<DeferredExecute>((runnable, delay) => {\n if (!isMounted()) {\n return;\n }\n\n cancel();\n\n if (Number.isFinite(delay)) {\n timeoutIdRef.current = setTimeout(() => runnable(), delay);\n } else {\n runnable();\n }\n }, []);\n\n return { cancel, execute };\n};\n"],"mappings":"AAAA,SAASA,WAAT,EAAsBC,SAAtB,EAAiCC,MAAjC,QAA+C,OAA/C;AACA,OAAOC,YAAP,MAAyB,gBAAzB;AAeA,eAAe,SAASC,mBAAT,GAAiD;EAC5D,MAAMC,SAAS,GAAGF,YAAY,EAA9B;EACA,MAAMG,YAAY,GAAGJ,MAAM,CAAsB,IAAtB,CAA3B;EAEA,MAAMK,MAAM,GAAGP,WAAW,CAAC,MAAM;IAC7B,IAAIM,YAAY,CAACE,OAAjB,EAA0B;MACtBC,YAAY,CAACH,YAAY,CAACE,OAAd,CAAZ;IACH;EACJ,CAJyB,EAIvB,EAJuB,CAA1B;EAMAP,SAAS,CAAC,MAAM;IACZ,OAAOM,MAAP;EACH,CAFQ,EAEN,EAFM,CAAT;EAIA,MAAMG,OAAO,GAAGV,WAAW,CAAkB,CAACW,QAAD,EAAWC,KAAX,KAAqB;IAC9D,IAAI,CAACP,SAAS,EAAd,EAAkB;MACd;IACH;;IAEDE,MAAM;;IAEN,IAAIM,MAAM,CAACC,QAAP,CAAgBF,KAAhB,CAAJ,EAA4B;MACxBN,YAAY,CAACE,OAAb,GAAuBO,UAAU,CAAC,MAAMJ,QAAQ,EAAf,EAAmBC,KAAnB,CAAjC;IACH,CAFD,MAEO;MACHD,QAAQ;IACX;EACJ,CAZ0B,EAYxB,EAZwB,CAA3B;EAcA,OAAO;IAAEJ,MAAF;IAAUG;EAAV,CAAP;AACH;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["Platform","useTheme","useElevationStyle","elevation","theme","shadow","select","android","ios","web","boxShadow"],"sources":["useElevationStyle.ts"],"sourcesContent":["import { Platform } from 'react-native';\nimport type { Elevation } from '@fountain-ui/styles';\nimport { useTheme } from '@fountain-ui/styles';\n\nexport default function useElevationStyle(elevation: Elevation) {\n const theme = useTheme();\n const shadow = theme.shadow[elevation];\n\n return Platform.select<any>({\n android: shadow?.elevation,\n ios: shadow?.shadow,\n web: shadow?.boxShadow,\n });\n};\n"],"mappings":"AAAA,SAASA,QAAT,QAAyB,cAAzB;AAEA,SAASC,QAAT,QAAyB,qBAAzB;AAEA,eAAe,SAASC,iBAAT,CAA2BC,SAA3B,EAAiD;EAC5D,MAAMC,KAAK,GAAGH,QAAQ,EAAtB;EACA,MAAMI,MAAM,GAAGD,KAAK,CAACC,MAAN,CAAaF,SAAb,CAAf;EAEA,OAAOH,QAAQ,CAACM,MAAT,CAAqB;IACxBC,OAAO,EAAEF,MAAF,aAAEA,MAAF,uBAAEA,MAAM,CAAEF,SADO;IAExBK,GAAG,EAAEH,MAAF,aAAEA,MAAF,uBAAEA,MAAM,CAAEA,MAFW;IAGxBI,GAAG,EAAEJ,MAAF,aAAEA,MAAF,uBAAEA,MAAM,CAAEK;EAHW,CAArB,CAAP;AAKH;AAAA"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
3
|
-
export default function useHeight(
|
|
2
|
+
import { useWorkletCallback } from 'react-native-reanimated';
|
|
3
|
+
export default function useHeight() {
|
|
4
|
+
let initialHeight = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
4
5
|
const [height, setHeight] = React.useState(initialHeight);
|
|
5
|
-
const onLayout =
|
|
6
|
+
const onLayout = useWorkletCallback(e => {
|
|
6
7
|
setHeight(e.nativeEvent.layout.height);
|
|
7
8
|
}, []);
|
|
8
9
|
return [height, onLayout];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["React","useWorkletCallback","useHeight","initialHeight","height","setHeight","useState","onLayout","e","nativeEvent","layout"],"sources":["useHeight.ts"],"sourcesContent":["import React from 'react';\nimport { ViewProps } from 'react-native';\nimport { useWorkletCallback } from 'react-native-reanimated';\n\ntype OnLayoutCallback = ViewProps['onLayout'];\n\nexport default function useHeight(initialHeight = 0): [number, OnLayoutCallback] {\n const [height, setHeight] = React.useState<number>(initialHeight);\n\n const onLayout = useWorkletCallback((e) => {\n setHeight(e.nativeEvent.layout.height);\n }, []);\n\n return [height, onLayout];\n};\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAEA,SAASC,kBAAT,QAAmC,yBAAnC;AAIA,eAAe,SAASC,SAAT,GAAkE;EAAA,IAA/CC,aAA+C,uEAA/B,CAA+B;EAC7E,MAAM,CAACC,MAAD,EAASC,SAAT,IAAsBL,KAAK,CAACM,QAAN,CAAuBH,aAAvB,CAA5B;EAEA,MAAMI,QAAQ,GAAGN,kBAAkB,CAAEO,CAAD,IAAO;IACvCH,SAAS,CAACG,CAAC,CAACC,WAAF,CAAcC,MAAd,CAAqBN,MAAtB,CAAT;EACH,CAFkC,EAEhC,EAFgC,CAAnC;EAIA,OAAO,CAACA,MAAD,EAASG,QAAT,CAAP;AACH;AAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
2
|
+
export default function useIsMounted() {
|
|
3
|
+
const mountedRef = useRef(false);
|
|
4
|
+
useEffect(() => {
|
|
5
|
+
mountedRef.current = true;
|
|
6
|
+
return () => {
|
|
7
|
+
mountedRef.current = false;
|
|
8
|
+
};
|
|
9
|
+
}, []);
|
|
10
|
+
return useCallback(() => mountedRef.current, []);
|
|
11
|
+
}
|
|
12
|
+
;
|
|
13
|
+
//# sourceMappingURL=useIsMounted.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useCallback","useEffect","useRef","useIsMounted","mountedRef","current"],"sources":["useIsMounted.ts"],"sourcesContent":["import { useCallback, useEffect, useRef } from 'react';\n\nexport interface UseIsMounted {\n (): boolean;\n}\n\nexport default function useIsMounted(): UseIsMounted {\n const mountedRef = useRef<boolean>(false);\n\n useEffect(() => {\n mountedRef.current = true;\n\n return () => {\n mountedRef.current = false;\n };\n }, []);\n\n return useCallback(() => mountedRef.current, []);\n};\n"],"mappings":"AAAA,SAASA,WAAT,EAAsBC,SAAtB,EAAiCC,MAAjC,QAA+C,OAA/C;AAMA,eAAe,SAASC,YAAT,GAAsC;EACjD,MAAMC,UAAU,GAAGF,MAAM,CAAU,KAAV,CAAzB;EAEAD,SAAS,CAAC,MAAM;IACZG,UAAU,CAACC,OAAX,GAAqB,IAArB;IAEA,OAAO,MAAM;MACTD,UAAU,CAACC,OAAX,GAAqB,KAArB;IACH,CAFD;EAGH,CANQ,EAMN,EANM,CAAT;EAQA,OAAOL,WAAW,CAAC,MAAMI,UAAU,CAACC,OAAlB,EAA2B,EAA3B,CAAlB;AACH;AAAA"}
|