@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 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["React","format","Calendar","LocaleConfig","Button","Typography","useTheme","YearPicker","DateTimePickerContext","formatDate","useDateTimePicker","useContext","DateTimePicker","props","currentMonth","Date","locale","markedDate","markedDateProp","maxDate","minDate","onDayPress","onYearPress","onYearPressProp","theme","yearPickerVisible","setYearPickerVisible","useState","locales","LeftArrow","RightArrow","date","defaultLocale","direction","selected","disableTouchEvent","selectedColor","palette","primary","main","selectedTextColor","contrastTextColor","toDate","backgroundColor","paper","default","calendarBackground","dayTextColor","text","textDisabledColor","hint"],"sources":["DateTimePicker.tsx"],"sourcesContent":["import React from 'react';\nimport { format } from 'date-fns';\n//@ts-ignore\nimport { Calendar, LocaleConfig } from 'react-native-calendars';\nimport { Button, Typography } from '@fountain-ui/core';\nimport { useTheme } from '@fountain-ui/styles';\nimport YearPicker from './YearPicker';\nimport { DateTimePickerContext } from './DateTimePickerProvider';\nimport type DateTimePickerProps from './DateTimePickerProps';\nimport { formatDate } from './utils';\n\nconst useDateTimePicker = () => {\n return React.useContext(DateTimePickerContext);\n};\n\nexport default function DateTimePicker(props: DateTimePickerProps) {\n const {\n currentMonth = new Date(),\n locale,\n markedDate: markedDateProp,\n maxDate,\n minDate,\n onDayPress,\n onYearPress: onYearPressProp,\n } = props;\n\n const theme = useTheme();\n\n const [yearPickerVisible, setYearPickerVisible] = React.useState(false);\n const { locales } = useDateTimePicker();\n\n //TODO: Need to update arrow components\n const LeftArrow = <Typography children={'<'} color={'textPrimary'}/>;\n const RightArrow = <Typography children={'>'} color={'textPrimary'}/>;\n\n const onYearPress = (date: Date) => {\n setYearPickerVisible(false);\n onYearPressProp && onYearPressProp(date);\n };\n\n if (locale) {\n LocaleConfig.locales = locales;\n LocaleConfig.defaultLocale = locale;\n }\n\n const markedDate = markedDateProp ? format(markedDateProp, 'yyyy-MM-dd') : '';\n\n if (yearPickerVisible) {\n return (\n <YearPicker\n date={currentMonth}\n locale={locale}\n maxDate={maxDate}\n minDate={minDate}\n onYearPress={onYearPress}\n />\n );\n }\n\n return (\n <Calendar\n current={currentMonth}\n onDayPress={onDayPress}\n maxDate={maxDate}\n minDate={minDate}\n renderArrow={(direction: string) => direction === 'left' ? LeftArrow : RightArrow}\n markedDates={{\n [markedDate]: {\n selected: true,\n disableTouchEvent: true,\n selectedColor: theme.palette.primary.main,\n selectedTextColor: theme.palette.primary.contrastTextColor,\n },\n }}\n // @ts-ignore\n renderHeader={(date) => (\n <Button\n children={formatDate(date.toDate(), locale)}\n variant={'text'}\n size={'small'}\n onPress={() => setYearPickerVisible(true)}\n />\n )}\n theme={{\n backgroundColor: theme.palette.paper.default,\n calendarBackground: theme.palette.paper.default,\n dayTextColor: theme.palette.text.primary,\n textDisabledColor: theme.palette.text.hint,\n }}\n />\n );\n};\n"],"mappings":"AAAA,OAAOA,KAA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iB,EAAEzB,KAAK,CAACa,OAAN,CAAcW,IAAd,CAAmBE;IAJnC;EAvBX,EADJ;AAgCH;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":[],"sources":["DateTimePickerProps.ts"],"sourcesContent":["import type { ComponentProps } from '@fountain-ui/core';\n\nexport interface Day {\n dateString: string;\n day: number;\n month: number;\n timestamp: number;\n year: number;\n}\n\nexport default interface DateTimePickerProps extends ComponentProps<{\n /**\n * To select month on calendar.\n * @default Date()\n */\n currentMonth?: Date;\n\n /**\n * Locale for calendar.\n */\n locale?: string;\n\n /**\n * Marked date on calendar.\n * @default Date()\n */\n markedDate?: Date;\n\n /**\n * Maximum date that can be selected, dates after maxDate will be grayed out.\n */\n maxDate?: Date;\n\n /**\n * Minimum date that can be selected, dates before minDate will be grayed out.\n */\n minDate?: Date;\n\n /**\n * Handler which gets executed on day press.\n */\n onDayPress?: (day: Day) => void;\n\n /**\n * Handler which gets executed on year press.\n */\n onYearPress?: (year: Date) => void;\n}> {}\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["React","defaultValue","locales","DateTimePickerContext","createContext","Provider"],"sources":["DateTimePickerProvider.ts"],"sourcesContent":["import React from 'react';\n\nexport interface DateTimePickerValue {\n locales: object;\n}\n\nconst defaultValue: DateTimePickerValue = {\n locales: {},\n};\n\nexport const DateTimePickerContext = React.createContext<DateTimePickerValue>(defaultValue);\n\nexport default DateTimePickerContext.Provider;"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAMA,MAAMC,YAAiC,GAAG;EACtCC,OAAO,EAAE;AAD6B,CAA1C;AAIA,OAAO,MAAMC,qBAAqB,gBAAGH,KAAK,CAACI,aAAN,CAAyCH,YAAzC,CAA9B;AAEP,eAAeE,qBAAqB,CAACE,QAArC"}
|
|
@@ -16,13 +16,14 @@ const useStyles = function () {
|
|
|
16
16
|
};
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
const YearPicker =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
const YearPicker = _ref => {
|
|
20
|
+
let {
|
|
21
|
+
date,
|
|
22
|
+
locale,
|
|
23
|
+
maxDate,
|
|
24
|
+
minDate,
|
|
25
|
+
onYearPress
|
|
26
|
+
} = _ref;
|
|
26
27
|
const styles = useStyles();
|
|
27
28
|
const ref = React.useRef(null);
|
|
28
29
|
const minYear = minDate ? getYear(minDate) : initYear;
|
|
@@ -50,16 +51,19 @@ const YearPicker = ({
|
|
|
50
51
|
}), /*#__PURE__*/React.createElement(FlatList, {
|
|
51
52
|
data: years,
|
|
52
53
|
keyExtractor: item => item.toString(),
|
|
53
|
-
renderItem:
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
54
|
+
renderItem: _ref2 => {
|
|
55
|
+
let {
|
|
56
|
+
item
|
|
57
|
+
} = _ref2;
|
|
58
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
59
|
+
children: item.toString(),
|
|
60
|
+
variant: 'text',
|
|
61
|
+
onPress: () => {
|
|
62
|
+
const newDate = setYear(date, item);
|
|
63
|
+
onYearPress(newDate);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
},
|
|
63
67
|
getItemLayout: getItemLayout,
|
|
64
68
|
style: styles.list,
|
|
65
69
|
ref: ref
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["React","FlatList","getYear","setYear","Button","Column","Typography","useTheme","formatDate","initYear","itemHeight","useStyles","theme","list","marginTop","spacing","maxHeight","YearPicker","date","locale","maxDate","minDate","onYearPress","styles","ref","useRef","minYear","maxYear","Date","years","Array","fill","map","v","i","useEffect","current","scrollToItem","animated","item","getItemLayout","data","index","length","offset","toString","newDate"],"sources":["YearPicker.tsx"],"sourcesContent":["import React from 'react';\nimport { FlatList } from 'react-native';\nimport { getYear, setYear } from 'date-fns';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { Button, Column, Typography, useTheme } from '@fountain-ui/core';\nimport { formatDate } from './utils';\n\nconst initYear = 1901;\nconst itemHeight = 40;\n\ninterface YearPickerProps {\n date: Date;\n locale?: string,\n maxDate?: Date;\n minDate?: Date;\n onYearPress: (date: Date) => void;\n}\n\ntype YearPickerStyles = NamedStylesStringUnion<'list'>;\n\nconst useStyles: UseStyles<YearPickerStyles> = function (): YearPickerStyles {\n const theme = useTheme();\n\n return {\n list: {\n marginTop: theme.spacing(1),\n maxHeight: 270,\n },\n };\n};\n\nconst YearPicker = ({\n date,\n locale,\n maxDate,\n minDate,\n onYearPress,\n}: YearPickerProps) => {\n const styles = useStyles();\n\n const ref = React.useRef<FlatList | null>(null);\n\n const minYear = minDate ? getYear(minDate) : initYear;\n const maxYear = maxDate ? getYear(maxDate) : getYear(new Date());\n const years = Array(maxYear - minYear + 1).fill(minYear).map((v, i) => v + i);\n\n React.useEffect(() => {\n ref.current?.scrollToItem({\n animated: false,\n item: getYear(date),\n });\n }, [date]);\n\n const getItemLayout = (data: Array<number> | null | undefined, index: number) => ({\n length: itemHeight,\n offset: itemHeight * index,\n index,\n });\n\n return (\n <Column>\n <Typography\n children={formatDate(date, locale)}\n color={'textPrimary'}\n variant={'subtitle2'}\n />\n <FlatList\n data={years}\n keyExtractor={item => item.toString()}\n renderItem={({ item }) => (\n <Button\n children={item.toString()}\n variant={'text'}\n onPress={() => {\n const newDate = setYear(date, item);\n onYearPress(newDate);\n }}\n />\n )}\n getItemLayout={getItemLayout}\n style={styles.list}\n ref={ref}\n />\n </Column>\n );\n};\n\nexport default YearPicker;\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,QAAT,QAAyB,cAAzB;AACA,SAASC,OA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AKG,CAACA,IAAD,CALH;;EAOA,MAAMsB,aAAa,GAAG,CAACC,IAAD,EAAyCC,KAAzC,MAA4D;IAC9EC,MAAM,EAAEjC,UADsE;IAE9EkC,MAAM,EAAElC,UAAU,GAAGgC,KAFyD;IAG9EA;EAH8E,CAA5D,CAAtB;;EAMA,oBACI,oBAAC,MAAD,qBACI,oBAAC,UAAD;IACI,QAAQ,EAAElC,UAAU,CAACU,IAAD,EAAOC,MAAP,CADxB;IAEI,KAAK,EAAE,aAFX;IAGI,OAAO,EAAE;EAHb,EADJ,eAMI,oBAAC,QAAD;IACI,IAAI,EAAEU,KADV;IAEI,YAAY,EAAEU,IAAI,IAAIA,IAAI,CAACM,QAAL,EAF1B;IAGI,UAAU,EAAE;MAAA,IAAC;QAAEN;MAAF,CAAD;MAAA,oBACR,oBAAC,MAAD;QACI,QAAQ,EAAEA,IAAI,CAACM,QAAL,EADd;QAEI,OAAO,EAAE,MAFb;QAGI,OAAO,EAAE,MAAM;UACX,MAAMC,OAAO,GAAG3C,OAAO,CAACe,IAAD,EAAOqB,IAAP,CAAvB;UACAjB,WAAW,CAACwB,OAAD,CAAX;QACH;MANL,EADQ;IAAA,CAHhB;IAaI,aAAa,EAAEN,aAbnB;IAcI,KAAK,EAAEjB,MAAM,CAACV,IAdlB;IAeI,GAAG,EAAEW;EAfT,EANJ,CADJ;AA0BH,CAtDD;;AAwDA,eAAeP,UAAf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["default","DateTimePickerProvider"],"sources":["index.ts"],"sourcesContent":["export { default } from './DateTimePicker';\nexport { default as DateTimePickerProvider } from './DateTimePickerProvider';\nexport type { default as DateTimePickerProps } from './DateTimePickerProps';"],"mappings":"AAAA,SAASA,OAAT,QAAwB,kBAAxB;AACA,SAASA,OAAO,IAAIC,sBAApB,QAAkD,0BAAlD"}
|
|
@@ -7,7 +7,8 @@ const localeMap = {
|
|
|
7
7
|
de: deLocale,
|
|
8
8
|
fr: frLocale
|
|
9
9
|
};
|
|
10
|
-
export const formatDate = (date
|
|
10
|
+
export const formatDate = function (date) {
|
|
11
|
+
let locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'en';
|
|
11
12
|
//@ts-ignore
|
|
12
13
|
return format(date, 'MMMM uuuu', {
|
|
13
14
|
locale: localeMap[locale]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["format","enLocale","deLocale","frLocale","localeMap","en","de","fr","formatDate","date","locale"],"sources":["utils.ts"],"sourcesContent":["import { format } from 'date-fns';\nimport enLocale from 'date-fns/locale/en-US';\nimport deLocale from 'date-fns/locale/de';\nimport frLocale from 'date-fns/locale/fr';\n\nconst localeMap = {\n en: enLocale,\n de: deLocale,\n fr: frLocale,\n};\n\nexport const formatDate = (date: Date, locale: string = 'en'): string => {\n //@ts-ignore\n return format(date, 'MMMM uuuu', { locale: localeMap[locale] });\n};"],"mappings":"AAAA,SAASA,MAAT,QAAuB,UAAvB;AACA,OAAOC,QAAP,MAAqB,uBAArB;AACA,OAAOC,QAAP,MAAqB,oBAArB;AACA,OAAOC,QAAP,MAAqB,oBAArB;AAEA,MAAMC,SAAS,GAAG;EACdC,EAAE,EAAEJ,QADU;EAEdK,EAAE,EAAEJ,QAFU;EAGdK,EAAE,EAAEJ;AAHU,CAAlB;AAMA,OAAO,MAAMK,UAAU,GAAG,UAACC,IAAD,EAA+C;EAAA,IAAlCC,MAAkC,uEAAjB,IAAiB;EACrE;EACA,OAAOV,MAAM,CAACS,IAAD,EAAO,WAAP,EAAoB;IAAEC,MAAM,EAAEN,SAAS,CAACM,MAAD;EAAnB,CAApB,CAAb;AACH,CAHM"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
2
|
import { StyleSheet, View } from 'react-native';
|
|
3
|
-
import Animated from 'react-native-reanimated';
|
|
3
|
+
import Animated, { useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';
|
|
4
4
|
const styles = StyleSheet.create({
|
|
5
5
|
container: {
|
|
6
6
|
height: 32,
|
|
@@ -22,8 +22,8 @@ export default function FlipCard(props) {
|
|
|
22
22
|
reanimationKey,
|
|
23
23
|
style
|
|
24
24
|
} = props;
|
|
25
|
-
const sharedAngle =
|
|
26
|
-
const animatedFrontCardStyle =
|
|
25
|
+
const sharedAngle = useSharedValue(0);
|
|
26
|
+
const animatedFrontCardStyle = useAnimatedStyle(() => {
|
|
27
27
|
return {
|
|
28
28
|
zIndex: sharedAngle.value < Z_INDEX_CHANGE_ANGLE ? 2 : 1,
|
|
29
29
|
transform: [{
|
|
@@ -32,8 +32,8 @@ export default function FlipCard(props) {
|
|
|
32
32
|
rotateX: `${sharedAngle.value}deg`
|
|
33
33
|
}]
|
|
34
34
|
};
|
|
35
|
-
});
|
|
36
|
-
const animatedBackCardStyle =
|
|
35
|
+
}, []);
|
|
36
|
+
const animatedBackCardStyle = useAnimatedStyle(() => {
|
|
37
37
|
return {
|
|
38
38
|
zIndex: sharedAngle.value <= Z_INDEX_CHANGE_ANGLE ? 1 : 2,
|
|
39
39
|
transform: [{
|
|
@@ -42,10 +42,10 @@ export default function FlipCard(props) {
|
|
|
42
42
|
rotateX: `${sharedAngle.value + 180}deg`
|
|
43
43
|
}]
|
|
44
44
|
};
|
|
45
|
-
});
|
|
45
|
+
}, []);
|
|
46
46
|
useEffect(() => {
|
|
47
47
|
sharedAngle.value = 0;
|
|
48
|
-
sharedAngle.value =
|
|
48
|
+
sharedAngle.value = withTiming(180, {
|
|
49
49
|
duration: 500
|
|
50
50
|
});
|
|
51
51
|
}, [reanimationKey]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["React","useEffect","StyleSheet","View","Animated","useAnimatedStyle","useSharedValue","withTiming","styles","create","container","height","width","animatedCard","alignItems","backfaceVisibility","justifyContent","position","PERSPECTIVE","Z_INDEX_CHANGE_ANGLE","FlipCard","props","backCard","frontCard","reanimationKey","style","sharedAngle","animatedFrontCardStyle","zIndex","value","transform","perspective","rotateX","animatedBackCardStyle","duration"],"sources":["FlipCard.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\nimport { StyleSheet, View } from 'react-native';\nimport Animated, { useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';\nimport type FlipCardProps from './FlipCardProps';\n\nconst styles = StyleSheet.create({\n container: {\n height: 32,\n width: 24,\n },\n animatedCard: {\n alignItems: 'center',\n backfaceVisibility: 'hidden',\n justifyContent: 'center',\n position: 'absolute',\n },\n});\n\nconst PERSPECTIVE = 100;\nconst Z_INDEX_CHANGE_ANGLE = 90;\n\nexport default function FlipCard(props: FlipCardProps) {\n const {\n backCard,\n frontCard,\n reanimationKey,\n style,\n } = props;\n\n const sharedAngle = useSharedValue(0);\n\n const animatedFrontCardStyle = useAnimatedStyle(() => {\n return {\n zIndex: sharedAngle.value < Z_INDEX_CHANGE_ANGLE ? 2 : 1,\n transform: [\n { perspective: PERSPECTIVE },\n { rotateX: `${sharedAngle.value}deg` },\n ],\n };\n }, []);\n\n const animatedBackCardStyle = useAnimatedStyle(() => {\n return {\n zIndex: sharedAngle.value <= Z_INDEX_CHANGE_ANGLE ? 1 : 2,\n transform: [\n { perspective: PERSPECTIVE },\n { rotateX: `${(sharedAngle.value + 180)}deg` },\n ],\n };\n }, []);\n\n useEffect(() => {\n sharedAngle.value = 0;\n sharedAngle.value = withTiming(180, { duration: 500 });\n }, [reanimationKey]);\n\n return (\n <View style={[styles.container, style]}>\n <Animated.View style={[styles.animatedCard, animatedFrontCardStyle]}>\n {frontCard}\n </Animated.View>\n\n <Animated.View style={[styles.animatedCard, animatedBackCardStyle]}>\n {backCard}\n </Animated.View>\n </View>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,SAAhB,QAAiC,OAAjC;AACA,SAASC,UAAT,EAAqBC,IAArB,QAAiC,cAAjC;AACA,OAAOC,QAAP,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MAAM;IACZyB,WAAW,CAACG,KAAZ,GAAoB,CAApB;IACAH,WAAW,CAACG,KAAZ,GAAoBtB,UAAU,CAAC,GAAD,EAAM;MAAE2B,QAAQ,EAAE;IAAZ,CAAN,CAA9B;EACH,CAHQ,EAGN,CAACV,cAAD,CAHM,CAAT;EAKA,oBACI,oBAAC,IAAD;IAAM,KAAK,EAAE,CAAChB,MAAM,CAACE,SAAR,EAAmBe,KAAnB;EAAb,gBACI,oBAAC,QAAD,CAAU,IAAV;IAAe,KAAK,EAAE,CAACjB,MAAM,CAACK,YAAR,EAAsBc,sBAAtB;EAAtB,GACKJ,SADL,CADJ,eAKI,oBAAC,QAAD,CAAU,IAAV;IAAe,KAAK,EAAE,CAACf,MAAM,CAACK,YAAR,EAAsBoB,qBAAtB;EAAtB,GACKX,QADL,CALJ,CADJ;AAWH;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":[],"sources":["FlipCardProps.ts"],"sourcesContent":["import React from 'react';\nimport { ComponentProps } from '@fountain-ui/core';\n\nexport default interface FlipCardProps extends ComponentProps<{\n /**\n * Element placed on backSide\n */\n backCard: React.ReactElement;\n\n /**\n * Element placed on frontSide\n */\n frontCard: React.ReactElement;\n\n /**\n * The key to reanimate Component, usually includes card content\n */\n reanimationKey?: string;\n}> {}"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["default"],"sources":["index.ts"],"sourcesContent":["export { default } from './FlipCard';\nexport type { default as FlipCardProps } from './FlipCardProps';"],"mappings":"AAAA,SAASA,OAAT,QAAwB,YAAxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["React","StatusBarContext","createContext","useStatusBarContext","useContext","Provider"],"sources":["Provider.ts"],"sourcesContent":["import React from 'react';\nimport type { StatusBarStyle } from 'react-native';\n\nexport interface StatusBarProviderValue {\n setTranslucent: (value: boolean) => void;\n setBackgroundColor: (value: string) => void;\n setHidden: (value: boolean) => void;\n setBarStyle: (value: StatusBarStyle, animated?: boolean) => void;\n}\n\nexport const StatusBarContext = React.createContext<StatusBarProviderValue | null>(null);\n\nexport const useStatusBarContext = () => {\n return React.useContext(StatusBarContext);\n};\n\nexport default StatusBarContext.Provider;"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAUA,OAAO,MAAMC,gBAAgB,gBAAGD,KAAK,CAACE,aAAN,CAAmD,IAAnD,CAAzB;AAEP,OAAO,MAAMC,mBAAmB,GAAG,MAAM;EACrC,OAAOH,KAAK,CAACI,UAAN,CAAiBH,gBAAjB,CAAP;AACH,CAFM;AAIP,eAAeA,gBAAgB,CAACI,QAAhC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["React","Platform","StatusBar","RNStatusBar","View","useSafeAreaInsets","useTheme","css","Provider","initialVisible","select","ios","android","StatusBarProvider","props","children","theme","defaultColor","palette","background","default","visible","setVisible","useState","backgroundViewColor","setBackgroundViewColor","setBackgroundColor","value","OS","setBarStyle","animated","setHidden","setTranslucent","shouldRenderBackgroundView","inset","backgroundViewStyle","backgroundColor","height","top","left","position","right","zIndex","statusBar"],"sources":["StatusBarProvider.tsx"],"sourcesContent":["import React from 'react';\nimport type { StatusBarStyle } from 'react-native';\nimport { Platform, StatusBar as RNStatusBar, View } from 'react-native';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\nimport { useTheme } from '@fountain-ui/core';\nimport { css } from '@fountain-ui/styles';\nimport Provider from './Provider';\nimport type StatusBarProviderProps from './StatusBarProviderProps';\n\nconst initialVisible = Platform.select({\n ios: true,\n android: false,\n});\n\nexport default function StatusBarProvider(props: StatusBarProviderProps) {\n const { children } = props;\n\n const theme = useTheme();\n const defaultColor = theme.palette.background.default;\n\n const [visible, setVisible] = React.useState(initialVisible);\n const [backgroundViewColor, setBackgroundViewColor] = React.useState(defaultColor);\n\n const setBackgroundColor = (value: string) => {\n if (Platform.OS === 'android') {\n RNStatusBar.setBackgroundColor(value);\n }\n\n if (Platform.OS === 'ios') {\n setBackgroundViewColor(value);\n }\n };\n\n const setBarStyle = (value: StatusBarStyle, animated?: boolean) => {\n RNStatusBar.setBarStyle(value, animated);\n };\n\n const setHidden = (value: boolean) => {\n if (Platform.OS === 'ios') {\n setVisible(!value);\n }\n\n RNStatusBar.setHidden(value);\n };\n\n const setTranslucent = (value: boolean) => {\n if (Platform.OS === 'android') {\n RNStatusBar.setTranslucent(value);\n }\n };\n\n const shouldRenderBackgroundView = Platform.OS === 'ios' && visible;\n\n const inset = useSafeAreaInsets();\n const backgroundViewStyle = css([\n {\n backgroundColor: backgroundViewColor,\n height: inset.top,\n left: 0,\n position: 'absolute',\n right: 0,\n top: 0,\n zIndex: theme.zIndex.statusBar,\n },\n ]);\n\n return (\n <Provider value={{\n setBackgroundColor,\n setBarStyle,\n setHidden,\n setTranslucent,\n }}>\n {shouldRenderBackgroundView ? (\n <View style={backgroundViewStyle}/>\n ) : null}\n {children}\n </Provider>\n );\n}"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAEA,SAASC,QAAT,EAAmBC,SAAS,IAAIC,WAAhC,EAA6CC,IAA7C,QAAyD,cAAzD;AACA,SAASC,iBAAT,QAAkC,gCAAlC;AACA,SAASC,QAAT,QAAyB,mBAAzB;AACA,SAASC,GAAT,QAAoB,qBAApB;AACA,OAAOC,QAAP,MAAqB,YAArB;AAGA,MAAMC,cAAc,GAAGR,QAAQ,CAACS,MAAT,CAAgB;EACnCC,GAAG,EAAE,IAD8B;EAEnCC,OAAO,EAAE;AAF0B,CAAhB,CAAvB;AAKA,eAAe,SAASC,iBAAT,CAA2BC,KAA3B,EAA0D;EACrE,MAAM;IAAEC;EAAF,IAAeD,KAArB;EAEA,MAAME,KAAK,GAAGV,QAAQ,EAAtB;EACA,MAAMW,YAAY,GAAGD,KAAK,CAACE,OAAN,CAA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AAQ,EAAE,UAJd;IAKIC,KAAK,EAAE,CALX;IAMIH,GAAG,EAAE,CANT;IAOII,MAAM,EAAE1B,KAAK,CAAC0B,MAAN,CAAaC;EAPzB,CAD4B,CAAD,CAA/B;EAYA,oBACI,oBAAC,QAAD;IAAU,KAAK,EAAE;MACbjB,kBADa;MAEbG,WAFa;MAGbE,SAHa;MAIbC;IAJa;EAAjB,GAMKC,0BAA0B,gBACvB,oBAAC,IAAD;IAAM,KAAK,EAAEE;EAAb,EADuB,GAEvB,IARR,EASKpB,QATL,CADJ;AAaH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":[],"sources":["StatusBarProviderProps.ts"],"sourcesContent":["import React from 'react';\n\nexport default interface StatusBarProviderProp {\n /**\n * The screens where the statusbar will be visible.\n */\n children: React.ReactNode;\n}"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["default","useStatusBarContext"],"sources":["index.ts"],"sourcesContent":["export { default } from './StatusBarProvider';\nexport { useStatusBarContext } from './Provider';\nexport type { default as StatusBarProviderProps } from './StatusBarProviderProps';"],"mappings":"AAAA,SAASA,OAAT,QAAwB,qBAAxB;AACA,SAASC,mBAAT,QAAoC,YAApC"}
|
|
@@ -1,37 +1,94 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
1
|
+
import React, { memo, useMemo, useState } from 'react';
|
|
2
|
+
import { Platform, View } from 'react-native';
|
|
3
|
+
import { runOnJS, useAnimatedReaction } from 'react-native-reanimated';
|
|
4
|
+
import { StyleSheet } from '@fountain-ui/core';
|
|
5
|
+
import PageStateContext from './PageStateContext';
|
|
6
|
+
const styles = StyleSheet.create({
|
|
7
|
+
fill: {
|
|
8
|
+
width: '100%',
|
|
9
|
+
height: '100%'
|
|
10
|
+
},
|
|
11
|
+
none: {
|
|
12
|
+
display: 'none'
|
|
13
|
+
}
|
|
14
|
+
});
|
|
5
15
|
|
|
6
|
-
|
|
16
|
+
function Page(props) {
|
|
7
17
|
const {
|
|
8
|
-
|
|
9
|
-
|
|
18
|
+
index,
|
|
19
|
+
children,
|
|
20
|
+
loading,
|
|
21
|
+
offscreenPageRerenderLimit,
|
|
22
|
+
sharedIndex
|
|
10
23
|
} = props;
|
|
11
|
-
return /*#__PURE__*/React.createElement(View, _extends({
|
|
12
|
-
collapsable: false
|
|
13
|
-
}, otherProps));
|
|
14
|
-
};
|
|
15
24
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} // isVisible is an important condition for determining memos on the web.
|
|
20
|
-
// Reference ViewPagerWeb's return.
|
|
25
|
+
const assumeInitialPageState = () => {
|
|
26
|
+
const activeIndex = sharedIndex.value;
|
|
27
|
+
const isActive = index === activeIndex;
|
|
21
28
|
|
|
29
|
+
if (loading === 'eager') {
|
|
30
|
+
return {
|
|
31
|
+
isActive,
|
|
32
|
+
isLoaded: true
|
|
33
|
+
};
|
|
34
|
+
}
|
|
22
35
|
|
|
23
|
-
|
|
24
|
-
return
|
|
25
|
-
|
|
36
|
+
const isLoaded = index >= activeIndex - offscreenPageRerenderLimit && index <= activeIndex + offscreenPageRerenderLimit;
|
|
37
|
+
return {
|
|
38
|
+
isActive,
|
|
39
|
+
isLoaded
|
|
40
|
+
};
|
|
41
|
+
};
|
|
26
42
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
43
|
+
const [pageState, setPageState] = useState(assumeInitialPageState);
|
|
44
|
+
const content = pageState.isLoaded ? children : null;
|
|
45
|
+
|
|
46
|
+
const onActiveStateChange = isActive => {
|
|
47
|
+
setPageState(prevState => ({ ...prevState,
|
|
48
|
+
isActive,
|
|
49
|
+
isLoaded: isActive || prevState.isLoaded
|
|
50
|
+
}));
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const onBecomeNeighbor = () => {
|
|
54
|
+
setPageState(prevState => ({ ...prevState,
|
|
55
|
+
isLoaded: true
|
|
56
|
+
}));
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
useAnimatedReaction(() => {
|
|
60
|
+
const activeIndex = sharedIndex.value;
|
|
61
|
+
const isActive = index === activeIndex;
|
|
62
|
+
const shouldRerender = index >= activeIndex - offscreenPageRerenderLimit && index <= activeIndex + offscreenPageRerenderLimit;
|
|
63
|
+
const becomeNeighbor = shouldRerender && !isActive;
|
|
64
|
+
return {
|
|
65
|
+
isActive,
|
|
66
|
+
becomeNeighbor
|
|
67
|
+
};
|
|
68
|
+
}, (nextState, prevState) => {
|
|
69
|
+
if (nextState.isActive !== (prevState === null || prevState === void 0 ? void 0 : prevState.isActive)) {
|
|
70
|
+
runOnJS(onActiveStateChange)(nextState.isActive);
|
|
71
|
+
} else if (nextState.becomeNeighbor) {
|
|
72
|
+
runOnJS(onBecomeNeighbor)();
|
|
73
|
+
}
|
|
74
|
+
}, [index]);
|
|
75
|
+
const contextValue = useMemo(() => ({
|
|
76
|
+
isActive: pageState.isActive
|
|
77
|
+
}), [pageState.isActive]);
|
|
78
|
+
const style = Platform.OS === 'web' ? pageState.isActive ? StyleSheet.absoluteFill : styles.none : styles.fill;
|
|
79
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
80
|
+
collapsable: false,
|
|
81
|
+
style: style
|
|
82
|
+
}, /*#__PURE__*/React.createElement(PageStateContext.Provider, {
|
|
83
|
+
value: contextValue
|
|
84
|
+
}, content));
|
|
85
|
+
}
|
|
30
86
|
|
|
87
|
+
export default /*#__PURE__*/memo(Page, (prevProps, nextProps) => {
|
|
31
88
|
if (prevProps.rerenderKey !== nextProps.rerenderKey) {
|
|
32
89
|
return false;
|
|
33
90
|
}
|
|
34
91
|
|
|
35
|
-
return prevProps.
|
|
92
|
+
return prevProps.index !== nextProps.index;
|
|
36
93
|
});
|
|
37
94
|
//# sourceMappingURL=ChildrenMemoizedPage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["React","memo","useMemo","useState","Platform","View","runOnJS","useAnimatedReaction","StyleSheet","PageStateContext","styles","create","fill","width","height","none","display","Page","props","index","children","loading","offscreenPageRerenderLimit","sharedIndex","assumeInitialPageState","activeIndex","value","isActive","isLoaded","pageState","setPageState","content","onActiveStateChange","prevState","onBecomeNeighbor","shouldRerender","becomeNeighbor","nextState","contextValue","style","OS","absoluteFill","prevProps","nextProps","rerenderKey"],"sources":["ChildrenMemoizedPage.tsx"],"sourcesContent":["import React, { memo, useMemo, useState } from 'react';\nimport { Platform, View } from 'react-native';\nimport { runOnJS, useAnimatedReaction } from 'react-native-reanimated';\nimport { StyleSheet } from '@fountain-ui/core';\nimport type { PageProps } from './ViewPagerProps';\nimport PageStateContext from './PageStateContext';\n\nconst styles = StyleSheet.create({\n fill: { width: '100%', height: '100%' },\n none: { display: 'none' },\n});\n\ninterface InternalPageState {\n isActive: boolean;\n isLoaded: boolean;\n}\n\nfunction Page(props: PageProps) {\n const {\n index,\n children,\n loading,\n offscreenPageRerenderLimit,\n sharedIndex,\n } = props;\n\n const assumeInitialPageState = (): InternalPageState => {\n const activeIndex = sharedIndex.value;\n\n const isActive = index === activeIndex;\n\n if (loading === 'eager') {\n return { isActive, isLoaded: true };\n }\n\n const isLoaded = index >= activeIndex - offscreenPageRerenderLimit\n && index <= activeIndex + offscreenPageRerenderLimit;\n\n return { isActive, isLoaded };\n };\n\n const [pageState, setPageState] = useState<InternalPageState>(assumeInitialPageState);\n\n const content = pageState.isLoaded ? children : null;\n\n const onActiveStateChange = (isActive: boolean) => {\n setPageState(prevState => ({\n ...prevState,\n isActive,\n isLoaded: isActive || prevState.isLoaded,\n }));\n };\n\n const onBecomeNeighbor = () => {\n setPageState(prevState => ({\n ...prevState,\n isLoaded: true,\n }));\n };\n\n useAnimatedReaction(\n () => {\n const activeIndex = sharedIndex.value;\n\n const isActive = index === activeIndex;\n\n const shouldRerender = index >= activeIndex - offscreenPageRerenderLimit\n && index <= activeIndex + offscreenPageRerenderLimit;\n\n const becomeNeighbor = shouldRerender && !isActive;\n\n return { isActive, becomeNeighbor };\n },\n (nextState, prevState) => {\n if (nextState.isActive !== prevState?.isActive) {\n runOnJS(onActiveStateChange)(nextState.isActive);\n } else if (nextState.becomeNeighbor) {\n runOnJS(onBecomeNeighbor)();\n }\n },\n [index],\n );\n\n const contextValue = useMemo(() => ({\n isActive: pageState.isActive,\n }), [pageState.isActive]);\n\n const style = Platform.OS === 'web'\n ? (pageState.isActive ? StyleSheet.absoluteFill : styles.none)\n : styles.fill;\n\n return (\n <View\n collapsable={false}\n style={style}\n >\n <PageStateContext.Provider value={contextValue}>\n {content}\n </PageStateContext.Provider>\n </View>\n );\n}\n\nexport default memo(Page, (prevProps, nextProps) => {\n if (prevProps.rerenderKey !== nextProps.rerenderKey) {\n return false;\n }\n\n return prevProps.index !== nextProps.index;\n});\n"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,IAAhB,EAAsBC,OAAtB,EAA+BC,QAA/B,QAA+C,OAA/C;AACA,SAASC,QAAT,EAAmBC,IAAnB,QAA+B,cAA/B;AACA,SAASC,OAAT,EAAkBC,mBAAlB,QAA6C,yBAA7C;AACA,SAASC,UAAT,QAA2B,mBAA3B;AAEA,OAAOC,gBAAP,MAA6B,oBAA7B;AAEA,MAAMC,MAAM,GAAGF,UAAU,CAACG,MAAX,CAAkB;EAC7BC,IAAI,EAAE;IAAEC,KAAK,EAAE,MAAT;IAAiBC,MAAM,EAAE;EAAzB,CADuB;EAE7BC,IAAI,EAAE;IAAEC,OAAO,EAAE;EAAX;AAFuB,CAAlB,CAAf;;AAUA,SAASC,IAAT,CAAcC,KAAd,EAAgC;EAC5B,MAAM;IACFC,KADE;IAEFC,QAFE;IAGFC,OAHE;IAIFC,0BAJE;IAKFC;EALE,IAMFL,KANJ;;EAQA,MAAMM,sBAAsB,GAAG,MAAyB;IACpD,MAAMC,WAAW,GAAGF,WAAW,CAACG,KAAhC;IAEA,MAAMC,QAAQ,GAAGR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S,CAAEN,QAAlC,CAAJ,EAAgD;MAC5CrB,OAAO,CAAC0B,mBAAD,CAAP,CAA6BK,SAAS,CAACV,QAAvC;IACH,CAFD,MAEO,IAAIU,SAAS,CAACD,cAAd,EAA8B;MACjC9B,OAAO,CAAC4B,gBAAD,CAAP;IACH;EACJ,CAnBc,EAoBf,CAACf,KAAD,CApBe,CAAnB;EAuBA,MAAMmB,YAAY,GAAGpC,OAAO,CAAC,OAAO;IAChCyB,QAAQ,EAAEE,SAAS,CAACF;EADY,CAAP,CAAD,EAExB,CAACE,SAAS,CAACF,QAAX,CAFwB,CAA5B;EAIA,MAAMY,KAAK,GAAGnC,QAAQ,CAACoC,EAAT,KAAgB,KAAhB,GACPX,SAAS,CAACF,QAAV,GAAqBnB,UAAU,CAACiC,YAAhC,GAA+C/B,MAAM,CAACK,IAD/C,GAERL,MAAM,CAACE,IAFb;EAIA,oBACI,oBAAC,IAAD;IACI,WAAW,EAAE,KADjB;IAEI,KAAK,EAAE2B;EAFX,gBAII,oBAAC,gBAAD,CAAkB,QAAlB;IAA2B,KAAK,EAAED;EAAlC,GACKP,OADL,CAJJ,CADJ;AAUH;;AAED,4BAAe9B,IAAI,CAACgB,IAAD,EAAO,CAACyB,SAAD,EAAYC,SAAZ,KAA0B;EAChD,IAAID,SAAS,CAACE,WAAV,KAA0BD,SAAS,CAACC,WAAxC,EAAqD;IACjD,OAAO,KAAP;EACH;;EAED,OAAOF,SAAS,CAACvB,KAAV,KAAoBwB,SAAS,CAACxB,KAArC;AACH,CANkB,CAAnB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
const initialPageState = {
|
|
3
|
+
isActive: false
|
|
4
|
+
};
|
|
5
|
+
const PageStateContext = /*#__PURE__*/createContext(initialPageState);
|
|
6
|
+
export const useViewPagerPageState = () => {
|
|
7
|
+
return useContext(PageStateContext);
|
|
8
|
+
};
|
|
9
|
+
export default PageStateContext;
|
|
10
|
+
//# sourceMappingURL=PageStateContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createContext","useContext","initialPageState","isActive","PageStateContext","useViewPagerPageState"],"sources":["PageStateContext.ts"],"sourcesContent":["import { createContext, useContext } from 'react';\n\ninterface PageState {\n isActive: boolean;\n}\n\nconst initialPageState: Readonly<PageState> = { isActive: false };\n\nconst PageStateContext = createContext<PageState>(initialPageState);\n\nexport const useViewPagerPageState = () => {\n return useContext(PageStateContext);\n};\n\nexport default PageStateContext;\n"],"mappings":"AAAA,SAASA,aAAT,EAAwBC,UAAxB,QAA0C,OAA1C;AAMA,MAAMC,gBAAqC,GAAG;EAAEC,QAAQ,EAAE;AAAZ,CAA9C;AAEA,MAAMC,gBAAgB,gBAAGJ,aAAa,CAAYE,gBAAZ,CAAtC;AAEA,OAAO,MAAMG,qBAAqB,GAAG,MAAM;EACvC,OAAOJ,UAAU,CAACG,gBAAD,CAAjB;AACH,CAFM;AAIP,eAAeA,gBAAf"}
|
|
@@ -1,53 +1,77 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import RNViewPager from '
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import React, { Children, forwardRef, useCallback, useEffect, useImperativeHandle, useRef } from 'react';
|
|
2
|
+
import RNViewPager from 'react-native-pager-view';
|
|
3
|
+
import { runOnJS, useAnimatedReaction, useSharedValue } from 'react-native-reanimated';
|
|
4
|
+
import { defaultInitialPage, defaultLoading, defaultOffscreenPageRerenderLimit, defaultPageComponent } from './utils';
|
|
5
|
+
const ViewPager = /*#__PURE__*/forwardRef(function ViewPager(props, ref) {
|
|
5
6
|
const {
|
|
6
7
|
children,
|
|
7
|
-
|
|
8
|
-
index,
|
|
8
|
+
initialPage = defaultInitialPage,
|
|
9
9
|
keyboardDismissMode = 'on-drag',
|
|
10
10
|
loading = defaultLoading,
|
|
11
|
+
offscreenPageRerenderLimit = defaultOffscreenPageRerenderLimit,
|
|
11
12
|
onChange,
|
|
12
13
|
pageComponent = defaultPageComponent,
|
|
13
|
-
enableNeighborPageRerender = defaultEnableNeighborPageRerender,
|
|
14
14
|
pageForceRerenderKey,
|
|
15
15
|
scrollEnabled = true,
|
|
16
|
-
style
|
|
16
|
+
style,
|
|
17
|
+
UNSTABLE_sharedIndex
|
|
17
18
|
} = props;
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
pageForceRerenderKey,
|
|
26
|
-
enableNeighborPageRerender
|
|
27
|
-
});
|
|
28
|
-
const handlePageSelected = React.useCallback(e => {
|
|
29
|
-
indexRef.current = e.nativeEvent.position;
|
|
19
|
+
const fallbackSharedIndex = useSharedValue(initialPage);
|
|
20
|
+
const sharedIndex = UNSTABLE_sharedIndex ?? fallbackSharedIndex;
|
|
21
|
+
const pagerRef = useRef(null);
|
|
22
|
+
const animationFrameRef = useRef(NaN);
|
|
23
|
+
const setPage = useCallback(newIndex => {
|
|
24
|
+
animationFrameRef.current = requestAnimationFrame(() => {
|
|
25
|
+
var _pagerRef$current;
|
|
30
26
|
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
(_pagerRef$current = pagerRef.current) === null || _pagerRef$current === void 0 ? void 0 : _pagerRef$current.setPage(newIndex);
|
|
28
|
+
});
|
|
29
|
+
}, []);
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
return () => {
|
|
32
|
+
if (animationFrameRef.current) {
|
|
33
|
+
cancelAnimationFrame(animationFrameRef.current);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}, []);
|
|
37
|
+
useAnimatedReaction(() => sharedIndex.value, result => {
|
|
38
|
+
runOnJS(setPage)(result);
|
|
39
|
+
}, [setPage]);
|
|
40
|
+
const handlePageSelected = useCallback(e => {
|
|
41
|
+
const currentIndex = sharedIndex.value;
|
|
42
|
+
const nextIndex = e.nativeEvent.position;
|
|
43
|
+
|
|
44
|
+
if (currentIndex === nextIndex) {
|
|
45
|
+
return;
|
|
33
46
|
}
|
|
34
|
-
}, [onChange]);
|
|
35
|
-
React.useEffect(() => {
|
|
36
|
-
if (index !== indexRef.current) {
|
|
37
|
-
var _pagerRef$current;
|
|
38
47
|
|
|
39
|
-
|
|
48
|
+
sharedIndex.value = nextIndex;
|
|
49
|
+
|
|
50
|
+
if (onChange) {
|
|
51
|
+
onChange(nextIndex);
|
|
40
52
|
}
|
|
41
|
-
}, [
|
|
53
|
+
}, [onChange]);
|
|
54
|
+
useImperativeHandle(ref, () => ({
|
|
55
|
+
setPage
|
|
56
|
+
}), [setPage]);
|
|
57
|
+
const PageComponent = pageComponent;
|
|
42
58
|
return /*#__PURE__*/React.createElement(RNViewPager, {
|
|
43
|
-
|
|
59
|
+
ref: pagerRef,
|
|
60
|
+
initialPage: initialPage,
|
|
44
61
|
keyboardDismissMode: keyboardDismissMode,
|
|
45
62
|
onPageSelected: handlePageSelected,
|
|
46
63
|
pageMargin: 8,
|
|
47
|
-
ref: pagerRef,
|
|
48
64
|
scrollEnabled: scrollEnabled,
|
|
49
65
|
style: style
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
|
|
66
|
+
}, Children.map(children, (child, index) => /*#__PURE__*/React.createElement(PageComponent, {
|
|
67
|
+
key: index,
|
|
68
|
+
children: child,
|
|
69
|
+
index: index,
|
|
70
|
+
loading: loading,
|
|
71
|
+
offscreenPageRerenderLimit: offscreenPageRerenderLimit,
|
|
72
|
+
rerenderKey: pageForceRerenderKey,
|
|
73
|
+
sharedIndex: sharedIndex
|
|
74
|
+
})));
|
|
75
|
+
});
|
|
76
|
+
export default ViewPager;
|
|
53
77
|
//# sourceMappingURL=ViewPagerNative.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["React","Children","forwardRef","useCallback","useEffect","useImperativeHandle","useRef","RNViewPager","runOnJS","useAnimatedReaction","useSharedValue","defaultInitialPage","defaultLoading","defaultOffscreenPageRerenderLimit","defaultPageComponent","ViewPager","props","ref","children","initialPage","keyboardDismissMode","loading","offscreenPageRerenderLimit","onChange","pageComponent","pageForceRerenderKey","scrollEnabled","style","UNSTABLE_sharedIndex","fallbackSharedIndex","sharedIndex","pagerRef","animationFrameRef","NaN","setPage","newIndex","current","requestAnimationFrame","cancelAnimationFrame","value","result","handlePageSelected","e","currentIndex","nextIndex","nativeEvent","position","PageComponent","map","child","index"],"sources":["ViewPagerNative.tsx"],"sourcesContent":["import React, { Children, forwardRef, useCallback, useEffect, useImperativeHandle, useRef } from 'react';\nimport type { ViewPagerOnPageSelectedEvent } from 'react-native-pager-view';\nimport RNViewPager from 'react-native-pager-view';\nimport { runOnJS, useAnimatedReaction, useSharedValue } from 'react-native-reanimated';\nimport type ViewPagerProps from './ViewPagerProps';\nimport type { ViewPagerInstance } from './ViewPagerProps';\nimport { defaultInitialPage, defaultLoading, defaultOffscreenPageRerenderLimit, defaultPageComponent } from './utils';\n\nconst ViewPager = forwardRef<ViewPagerInstance, ViewPagerProps>(function ViewPager(props, ref) {\n const {\n children,\n initialPage = defaultInitialPage,\n keyboardDismissMode = 'on-drag',\n loading = defaultLoading,\n offscreenPageRerenderLimit = defaultOffscreenPageRerenderLimit,\n onChange,\n pageComponent = defaultPageComponent,\n pageForceRerenderKey,\n scrollEnabled = true,\n style,\n UNSTABLE_sharedIndex,\n } = props;\n\n const fallbackSharedIndex = useSharedValue<number>(initialPage);\n\n const sharedIndex = UNSTABLE_sharedIndex ?? fallbackSharedIndex;\n\n const pagerRef = useRef<RNViewPager | null>(null);\n\n const animationFrameRef = useRef<number>(NaN);\n\n const setPage = useCallback((newIndex: number) => {\n animationFrameRef.current = requestAnimationFrame(() => {\n pagerRef.current?.setPage(newIndex);\n });\n }, []);\n\n useEffect(() => {\n return () => {\n if (animationFrameRef.current) {\n cancelAnimationFrame(animationFrameRef.current);\n }\n };\n }, []);\n\n useAnimatedReaction(\n () => sharedIndex.value,\n (result) => {\n runOnJS(setPage)(result);\n },\n [setPage],\n );\n\n const handlePageSelected = useCallback((e: ViewPagerOnPageSelectedEvent) => {\n const currentIndex = sharedIndex.value;\n const nextIndex = e.nativeEvent.position;\n\n if (currentIndex === nextIndex) {\n return;\n }\n\n sharedIndex.value = nextIndex;\n\n if (onChange) {\n onChange(nextIndex);\n }\n }, [onChange]);\n\n useImperativeHandle(\n ref,\n () => ({ setPage }),\n [setPage],\n );\n\n const PageComponent = pageComponent;\n\n return (\n <RNViewPager\n ref={pagerRef}\n initialPage={initialPage}\n keyboardDismissMode={keyboardDismissMode}\n onPageSelected={handlePageSelected}\n pageMargin={8}\n scrollEnabled={scrollEnabled}\n style={style}\n >\n {Children.map(children, (child, index) => (\n <PageComponent\n key={index}\n children={child}\n index={index}\n loading={loading}\n offscreenPageRerenderLimit={offscreenPageRerenderLimit}\n rerenderKey={pageForceRerenderKey}\n sharedIndex={sharedIndex}\n />\n ))}\n </RNViewPager>\n );\n});\n\nexport default ViewPager;\n"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,UAA1B,EAAsCC,WAAtC,EAAmDC,SAAnD,EAA8DC,mBAA9D,EAAmFC,MAAnF,QAAiG,OAAjG;AAEA,OAAOC,WAAP,MAAwB,yBAAxB;AACA,SAASC,OAAT,EAAkBC,mBAAlB,EAAuCC,cAAvC,QAA6D,yBAA7D;AAGA,SAASC,kBAAT,EAA6BC,cAA7B,EAA6CC,iCAA7C,EAAgFC,oBAAhF,QAA4G,SAA5G;AAEA,MAAMC,SAAS,gBAAGb,UAAU,CAAoC,SAASa,SAAT,CAAmBC,KAAnB,EAA0BC,GAA1B,EAA+B;EAC3F,MAAM;IACFC,QADE;IAEFC,WAAW,GAAGR,kBAFZ;IAGFS,mBAAmB,GAAG,SAHpB;IAIFC,OAAO,GAAGT,cAJR;IAKFU,0BAA0B,GAAGT,iCAL3B;IAMFU,QANE;IAOFC,aAAa,GAAGV,oBAPd;IAQFW,oBARE;IASFC,aAAa,GAAG,IATd;IAUFC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e,EAEf,OAAO;IAAEiB;EAAF,CAAP,CAFe,EAGf,CAACA,OAAD,CAHe,CAAnB;EAMA,MAAMa,aAAa,GAAGvB,aAAtB;EAEA,oBACI,oBAAC,WAAD;IACI,GAAG,EAAEO,QADT;IAEI,WAAW,EAAEZ,WAFjB;IAGI,mBAAmB,EAAEC,mBAHzB;IAII,cAAc,EAAEqB,kBAJpB;IAKI,UAAU,EAAE,CALhB;IAMI,aAAa,EAAEf,aANnB;IAOI,KAAK,EAAEC;EAPX,GASK1B,QAAQ,CAAC+C,GAAT,CAAa9B,QAAb,EAAuB,CAAC+B,KAAD,EAAQC,KAAR,kBACpB,oBAAC,aAAD;IACI,GAAG,EAAEA,KADT;IAEI,QAAQ,EAAED,KAFd;IAGI,KAAK,EAAEC,KAHX;IAII,OAAO,EAAE7B,OAJb;IAKI,0BAA0B,EAAEC,0BALhC;IAMI,WAAW,EAAEG,oBANjB;IAOI,WAAW,EAAEK;EAPjB,EADH,CATL,CADJ;AAuBH,CA3F2B,CAA5B;AA6FA,eAAef,SAAf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":[],"sources":["ViewPagerProps.ts"],"sourcesContent":["import type { ComponentType, PropsWithChildren, ReactNode, Ref } from 'react';\nimport type { ViewProps } from 'react-native';\nimport type { SharedValue } from 'react-native-reanimated';\nimport type { ComponentProps } from '@fountain-ui/core';\n\nexport type KeyboardDismissMode = 'none' | 'on-drag';\n\nexport type PageProps = PropsWithChildren<ViewProps> & {\n index: number;\n loading: ViewPagerProps['loading'];\n offscreenPageRerenderLimit: number;\n sharedIndex: SharedValue<number>;\n rerenderKey?: ViewPagerProps['pageForceRerenderKey'];\n};\n\nexport type PageComponent = ComponentType<PageProps>;\n\nexport type Loading = 'lazy' | 'eager';\n\nexport interface ViewPagerInstance {\n /**\n * Function to scroll to a specific page in the ViewPager. Invalid index is ignored.\n * @param index\n */\n setPage: (index: number) => void;\n}\n\nexport default interface ViewPagerProps extends ComponentProps<{\n ref?: Ref<ViewPagerInstance>;\n\n /**\n * Collection of ViewPager components.\n */\n children?: ReactNode;\n\n /**\n * Index of initial page that should be selected.\n * @default 0\n */\n initialPage?: number;\n\n /**\n * Whether to load the page immediately (`eager`) or on an as-needed basis (`lazy`).\n * @default 'lazy'\n */\n loading?: Loading;\n\n /**\n * Mobile only. The number of pages that should be re-rendered to either side of the current page.\n * Changing this value after the component mount has no effect.\n * @default 0\n */\n offscreenPageRerenderLimit?: number;\n\n /**\n * Callback fired when an index is changed.\n */\n onChange?: (newIndex: number) => void,\n\n /**\n * The component used to render the wrapper of the page.\n * @default 'ChildrenMemoizedPage'\n */\n pageComponent?: PageComponent,\n\n /**\n * When this value is changed, page will be rerender.\n */\n pageForceRerenderKey?: any;\n\n /**\n * Mobile only. Should pager view scroll, when scroll enabled.\n * @default true\n */\n scrollEnabled?: boolean;\n\n /**\n * Mobile only. Determines whether the keyboard gets dismissed in response to a drag.\n * @default 'on-drag'\n */\n keyboardDismissMode?: KeyboardDismissMode;\n\n /**\n * Unstable API.\n */\n UNSTABLE_sharedIndex?: SharedValue<number>;\n}> {}\n"],"mappings":""}
|