@fountain-ui/lab 3.0.0-alpha.23 → 3.0.0-alpha.25
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/BottomSheet/BottomSheetNative.js +1 -12
- package/build/commonjs/BottomSheet/BottomSheetNative.js.map +1 -1
- package/build/commonjs/BottomSheet/BottomSheetWeb.js +1 -2
- package/build/commonjs/BottomSheet/BottomSheetWeb.js.map +1 -1
- package/build/commonjs/Carousel/components/InternalContext.js.map +1 -1
- package/build/commonjs/Carousel/components/ItemView.js.map +1 -1
- package/build/commonjs/Carousel/components/useItemInterpolation.js.map +1 -1
- package/build/commonjs/Carousel/hooks/usePagingAnimator.js.map +1 -1
- package/build/commonjs/Carousel/types.js.map +1 -1
- package/build/commonjs/ComicViewer/ViewerItem.js.map +1 -1
- package/build/commonjs/DateTimePicker/YearPicker.js.map +1 -1
- package/build/module/BottomSheet/BottomSheetNative.js +1 -11
- package/build/module/BottomSheet/BottomSheetNative.js.map +1 -1
- package/build/module/BottomSheet/BottomSheetWeb.js +1 -2
- package/build/module/BottomSheet/BottomSheetWeb.js.map +1 -1
- package/build/module/Carousel/components/InternalContext.js.map +1 -1
- package/build/module/Carousel/components/ItemView.js.map +1 -1
- package/build/module/Carousel/components/useItemInterpolation.js.map +1 -1
- package/build/module/Carousel/hooks/usePagingAnimator.js.map +1 -1
- package/build/module/Carousel/types.js.map +1 -1
- package/build/module/ComicViewer/ViewerItem.js.map +1 -1
- package/build/module/DateTimePicker/YearPicker.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/components/InternalContext.d.ts +1 -1
- package/build/typescript/Carousel/components/ItemView.d.ts +1 -1
- package/build/typescript/Carousel/components/useItemInterpolation.d.ts +1 -1
- package/build/typescript/Carousel/hooks/usePagingAnimator.d.ts +1 -1
- package/build/typescript/Carousel/types.d.ts +2 -2
- package/build/typescript/ComicViewer/ComicViewer.d.ts +0 -1
- package/build/typescript/ComicViewer/ReloadButton.d.ts +0 -1
- package/build/typescript/ComicViewer/ViewerItem.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/ViewabilityTrackerView/ViewabilityTrackerView.d.ts +0 -1
- package/build/typescript/hooks/useUnstableToggleDisplayStyle.d.ts +1 -1
- package/package.json +7 -7
- package/src/BottomSheet/BottomSheetNative.tsx +2 -15
- package/src/BottomSheet/BottomSheetWeb.tsx +1 -3
- package/src/Carousel/components/InternalContext.ts +1 -1
- package/src/Carousel/components/ItemView.tsx +1 -1
- package/src/Carousel/components/useItemInterpolation.ts +1 -1
- package/src/Carousel/hooks/usePagingAnimator.ts +1 -1
- package/src/Carousel/types.ts +2 -2
- package/src/ComicViewer/ViewerItem.tsx +2 -2
- package/src/DateTimePicker/YearPicker.tsx +1 -1
- package/build/commonjs/BottomSheet/useDynamicSnapPoints.native.js +0 -22
- package/build/commonjs/BottomSheet/useDynamicSnapPoints.native.js.map +0 -1
- package/build/module/BottomSheet/useDynamicSnapPoints.native.js +0 -14
- package/build/module/BottomSheet/useDynamicSnapPoints.native.js.map +0 -1
- package/build/typescript/BottomSheet/useDynamicSnapPoints.native.d.ts +0 -21
- package/src/BottomSheet/useDynamicSnapPoints.native.ts +0 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useContext","useMemo","Animated","InternalContext","OVERSCROLL_FRICTION_FACTOR","useItemInterpolation","index","itemWidth","data","globalInterpolation","loop","numberOfData","length","interpolationConfigOnLoop","lastIndex","maxWidth","Math","abs","halfOfItemWidth","positiveCount","round","startPosition","max","min","inputRange","Number","MIN_VALUE","outputRange","extrapolate","interpolationConfigOnNoLoop","friction","interpolationConfig","localOffsetX","interpolate","divide"],"sources":["useItemInterpolation.ts"],"sourcesContent":["import { useContext, useMemo } from 'react';\nimport { Animated } from 'react-native';\nimport InternalContext from './InternalContext';\n\nconst OVERSCROLL_FRICTION_FACTOR = 4;\n\nexport default function useItemInterpolation(index: number): Animated.AnimatedInterpolation {\n const {\n itemWidth,\n data,\n globalInterpolation,\n loop,\n } = useContext(InternalContext);\n\n const numberOfData = data.length;\n\n const interpolationConfigOnLoop = useMemo<Animated.InterpolationConfigType>(() => {\n const lastIndex = numberOfData - 1;\n const maxWidth = Math.abs(itemWidth * numberOfData);\n const halfOfItemWidth = 0.5 * itemWidth;\n\n const positiveCount = Math.round(lastIndex / 2);\n const startPosition = index > positiveCount\n ? (index - numberOfData) * itemWidth\n : itemWidth * index;\n\n const max = positiveCount * itemWidth;\n const min = -((lastIndex - positiveCount) * itemWidth);\n\n const inputRange = [\n -maxWidth,\n min - halfOfItemWidth - startPosition - Number.MIN_VALUE,\n min - halfOfItemWidth - startPosition,\n 0,\n max + halfOfItemWidth - startPosition,\n max + halfOfItemWidth - startPosition + Number.MIN_VALUE,\n maxWidth,\n ];\n\n const outputRange = [\n startPosition,\n max + halfOfItemWidth - Number.MIN_VALUE,\n min - halfOfItemWidth,\n startPosition,\n max + halfOfItemWidth,\n min - halfOfItemWidth + Number.MIN_VALUE,\n startPosition,\n ];\n\n return {\n inputRange,\n outputRange,\n extrapolate: 'clamp',\n };\n }, [\n index,\n itemWidth,\n numberOfData,\n ]);\n\n const interpolationConfigOnNoLoop = useMemo<Animated.InterpolationConfigType>(() => {\n const lastIndex = numberOfData - 1;\n const maxWidth = itemWidth * lastIndex;\n const startPosition = itemWidth * index;\n const friction = itemWidth / OVERSCROLL_FRICTION_FACTOR;\n\n const inputRange = [\n -(maxWidth + itemWidth), // overscroll\n -maxWidth,\n 0,\n itemWidth, // overscroll\n ];\n\n const outputRange = [\n -maxWidth + startPosition - friction,\n -maxWidth + startPosition,\n startPosition,\n startPosition + friction,\n ];\n\n return {\n inputRange,\n outputRange,\n extrapolate: 'clamp',\n };\n }, [\n index,\n itemWidth,\n numberOfData,\n ]);\n\n return useMemo(() => {\n const interpolationConfig = loop\n ? interpolationConfigOnLoop\n : interpolationConfigOnNoLoop;\n\n const localOffsetX = globalInterpolation.interpolate(interpolationConfig);\n\n return Animated.divide(localOffsetX, itemWidth);\n }, [\n globalInterpolation,\n interpolationConfigOnLoop,\n interpolationConfigOnNoLoop,\n itemWidth,\n loop,\n ]);\n};\n"],"mappings":"AAAA,SAASA,UAAT,EAAqBC,OAArB,QAAoC,OAApC;AACA,SAASC,QAAT,QAAyB,cAAzB;AACA,OAAOC,eAAP,MAA4B,mBAA5B;AAEA,MAAMC,0BAA0B,GAAG,CAAnC;AAEA,eAAe,SAASC,oBAAT,CAA8BC,KAA9B,
|
|
1
|
+
{"version":3,"names":["useContext","useMemo","Animated","InternalContext","OVERSCROLL_FRICTION_FACTOR","useItemInterpolation","index","itemWidth","data","globalInterpolation","loop","numberOfData","length","interpolationConfigOnLoop","lastIndex","maxWidth","Math","abs","halfOfItemWidth","positiveCount","round","startPosition","max","min","inputRange","Number","MIN_VALUE","outputRange","extrapolate","interpolationConfigOnNoLoop","friction","interpolationConfig","localOffsetX","interpolate","divide"],"sources":["useItemInterpolation.ts"],"sourcesContent":["import { useContext, useMemo } from 'react';\nimport { Animated } from 'react-native';\nimport InternalContext from './InternalContext';\n\nconst OVERSCROLL_FRICTION_FACTOR = 4;\n\nexport default function useItemInterpolation(index: number): Animated.AnimatedInterpolation<string> {\n const {\n itemWidth,\n data,\n globalInterpolation,\n loop,\n } = useContext(InternalContext);\n\n const numberOfData = data.length;\n\n const interpolationConfigOnLoop = useMemo<Animated.InterpolationConfigType>(() => {\n const lastIndex = numberOfData - 1;\n const maxWidth = Math.abs(itemWidth * numberOfData);\n const halfOfItemWidth = 0.5 * itemWidth;\n\n const positiveCount = Math.round(lastIndex / 2);\n const startPosition = index > positiveCount\n ? (index - numberOfData) * itemWidth\n : itemWidth * index;\n\n const max = positiveCount * itemWidth;\n const min = -((lastIndex - positiveCount) * itemWidth);\n\n const inputRange = [\n -maxWidth,\n min - halfOfItemWidth - startPosition - Number.MIN_VALUE,\n min - halfOfItemWidth - startPosition,\n 0,\n max + halfOfItemWidth - startPosition,\n max + halfOfItemWidth - startPosition + Number.MIN_VALUE,\n maxWidth,\n ];\n\n const outputRange = [\n startPosition,\n max + halfOfItemWidth - Number.MIN_VALUE,\n min - halfOfItemWidth,\n startPosition,\n max + halfOfItemWidth,\n min - halfOfItemWidth + Number.MIN_VALUE,\n startPosition,\n ];\n\n return {\n inputRange,\n outputRange,\n extrapolate: 'clamp',\n };\n }, [\n index,\n itemWidth,\n numberOfData,\n ]);\n\n const interpolationConfigOnNoLoop = useMemo<Animated.InterpolationConfigType>(() => {\n const lastIndex = numberOfData - 1;\n const maxWidth = itemWidth * lastIndex;\n const startPosition = itemWidth * index;\n const friction = itemWidth / OVERSCROLL_FRICTION_FACTOR;\n\n const inputRange = [\n -(maxWidth + itemWidth), // overscroll\n -maxWidth,\n 0,\n itemWidth, // overscroll\n ];\n\n const outputRange = [\n -maxWidth + startPosition - friction,\n -maxWidth + startPosition,\n startPosition,\n startPosition + friction,\n ];\n\n return {\n inputRange,\n outputRange,\n extrapolate: 'clamp',\n };\n }, [\n index,\n itemWidth,\n numberOfData,\n ]);\n\n return useMemo(() => {\n const interpolationConfig = loop\n ? interpolationConfigOnLoop\n : interpolationConfigOnNoLoop;\n\n const localOffsetX = globalInterpolation.interpolate(interpolationConfig);\n\n return Animated.divide(localOffsetX, itemWidth);\n }, [\n globalInterpolation,\n interpolationConfigOnLoop,\n interpolationConfigOnNoLoop,\n itemWidth,\n loop,\n ]);\n};\n"],"mappings":"AAAA,SAASA,UAAT,EAAqBC,OAArB,QAAoC,OAApC;AACA,SAASC,QAAT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BAHD,EAICtB,SAJD,EAKCG,IALD,CARW,CAAd;AAeH;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useCallback","useMemo","useRef","Animated","useAnimatedValue","directionToValue","itemWidth","direction","toValueCompensator","toValue","currentOffset","remainder","Math","abs","halfOfItemWidth","compensateVector","usePagingAnimator","config","createScrollAnimation","indexController","initialIndex","loop","numberOfData","getCurrentIndex","lastIndex","notifyScrollStateHasChanged","initialOffsetX","accumulativeOffsetX","animationOffsetX","gestureTranslationX","globalInterpolation","add","toValueRef","currentOffsetRef","isAnimatingRef","maxWidth","ensureOffsetBoundary","offset","isCloseToEnd","signOfOffset","requireNewOffset","newOffset","nextOffset","current","setValue","interruptAnimation","stopAnimation","lastValue","prevOffset","totalOffset","state","finalizeAnimation","startPagingAnimation","type","configWithDefaults","animated","currentIndex","getValueByDirectionOnAllAdjacentItemsVisible","compensateToValue","getValueByDirectionalPagingOnLoopDisabled","_config","isOriginatedFromGesture","getValueByDirectionalPaging","_configWithDefaults","getValueByIndexPaging","index","distance","wantedToValue","lastGestureTranslationX","Number","isFinite","animation","start","finished"],"sources":["usePagingAnimator.ts"],"sourcesContent":["import { useCallback, useMemo, useRef } from 'react';\nimport { Animated } from 'react-native';\nimport { useAnimatedValue } from '@fountain-ui/core';\nimport type {\n CreateScrollAnimation,\n DirectionalPagingAnimationConfig,\n IndexController,\n IndexPagingAnimationConfig,\n PagingAnimationConfig,\n PagingAnimationType,\n PagingDirection,\n StartPagingAnimation,\n} from '../types';\n\nexport interface PagingAnimatorConfig {\n createScrollAnimation: CreateScrollAnimation;\n itemWidth: number;\n indexController: IndexController;\n initialIndex: number;\n loop: boolean;\n numberOfData: number;\n}\n\nexport interface PagingAnimator {\n gestureTranslationX: Animated.Value;\n globalInterpolation: Animated.AnimatedInterpolation;\n interruptAnimation: () => void;\n startPagingAnimation: StartPagingAnimation;\n}\n\nfunction directionToValue(itemWidth: number) {\n return function (direction: PagingDirection): number {\n switch (direction) {\n case 'next':\n return -itemWidth;\n case 'prev':\n return itemWidth;\n case 'stay':\n return 0;\n }\n };\n}\n\nfunction toValueCompensator(itemWidth: number) {\n return function (toValue: number, currentOffset: number): number {\n const remainder = Math.abs(currentOffset % itemWidth);\n\n const halfOfItemWidth = Math.abs(itemWidth / 2);\n const compensateVector = remainder > halfOfItemWidth\n ? remainder - itemWidth\n : remainder;\n\n const direction = currentOffset > 0 ? -1 : 1;\n\n return toValue + (direction * compensateVector);\n };\n}\n\nexport default function usePagingAnimator(config: PagingAnimatorConfig): PagingAnimator {\n const {\n createScrollAnimation,\n itemWidth,\n indexController,\n initialIndex,\n loop,\n numberOfData,\n } = config;\n\n const {\n getCurrentIndex,\n lastIndex,\n notifyScrollStateHasChanged,\n } = indexController;\n\n const initialOffsetX = itemWidth * initialIndex;\n const accumulativeOffsetX = useAnimatedValue(initialOffsetX);\n const animationOffsetX = useAnimatedValue(0);\n const gestureTranslationX = useAnimatedValue(0);\n\n const globalInterpolation = useMemo(() => {\n return Animated.add(\n Animated.add(accumulativeOffsetX, animationOffsetX),\n gestureTranslationX,\n );\n }, []);\n\n const toValueRef = useRef<number>(0);\n const currentOffsetRef = useRef<number>(0);\n\n const isAnimatingRef = useRef<boolean>(false);\n\n const maxWidth = Math.abs(numberOfData * itemWidth);\n\n const ensureOffsetBoundary: (offset: number) => number = useCallback((offset: number) => {\n if (loop) {\n const isCloseToEnd = Math.abs(offset) >= (maxWidth - itemWidth);\n if (isCloseToEnd) {\n const signOfOffset = offset > 0 ? 1 : -1;\n return offset + (-signOfOffset * maxWidth);\n }\n }\n\n return offset % maxWidth;\n }, [itemWidth, loop, maxWidth]);\n\n const requireNewOffset = useCallback((newOffset: number) => {\n const nextOffset = ensureOffsetBoundary(newOffset);\n\n currentOffsetRef.current = nextOffset;\n accumulativeOffsetX.setValue(nextOffset);\n\n toValueRef.current = 0;\n animationOffsetX.setValue(0);\n }, [\n ensureOffsetBoundary,\n ]);\n\n const interruptAnimation = useCallback(() => {\n if (!isAnimatingRef.current) {\n return;\n }\n\n animationOffsetX.stopAnimation(lastValue => {\n isAnimatingRef.current = false;\n\n const prevOffset = currentOffsetRef.current;\n const totalOffset = prevOffset + lastValue;\n\n requireNewOffset(totalOffset);\n\n notifyScrollStateHasChanged({ offset: totalOffset, state: 'interrupted' });\n });\n }, [\n notifyScrollStateHasChanged,\n requireNewOffset,\n ]);\n\n const finalizeAnimation = useCallback(() => {\n isAnimatingRef.current = false;\n\n const prevOffset = currentOffsetRef.current;\n const toValue = toValueRef.current;\n const totalOffset = prevOffset + toValue;\n\n requireNewOffset(totalOffset);\n\n notifyScrollStateHasChanged({ offset: totalOffset, state: 'idle' });\n }, [\n notifyScrollStateHasChanged,\n requireNewOffset,\n ]);\n\n const startPagingAnimation = useCallback((type: PagingAnimationType, config: PagingAnimationConfig) => {\n if (isAnimatingRef.current) {\n return;\n }\n\n const configWithDefaults: PagingAnimationConfig = {\n animated: true,\n ...config,\n };\n\n const currentIndex = getCurrentIndex();\n\n const getValueByDirectionOnAllAdjacentItemsVisible = directionToValue(itemWidth);\n const compensateToValue = toValueCompensator(itemWidth);\n\n const getValueByDirectionalPagingOnLoopDisabled = (_config: DirectionalPagingAnimationConfig): number => {\n const { direction, isOriginatedFromGesture } = _config;\n\n if (currentIndex === 0 && direction === 'prev') {\n return isOriginatedFromGesture\n ? getValueByDirectionOnAllAdjacentItemsVisible('stay')\n : -lastIndex * itemWidth; // last position\n } else if (currentIndex === lastIndex && direction === 'next') {\n return isOriginatedFromGesture\n ? getValueByDirectionOnAllAdjacentItemsVisible('stay')\n : lastIndex * itemWidth; // first position\n }\n return getValueByDirectionOnAllAdjacentItemsVisible(direction);\n };\n\n const getValueByDirectionalPaging = (_config: DirectionalPagingAnimationConfig): number => {\n const _configWithDefaults: DirectionalPagingAnimationConfig = {\n isOriginatedFromGesture: false,\n ..._config,\n };\n\n return loop\n ? getValueByDirectionOnAllAdjacentItemsVisible(_configWithDefaults.direction)\n : getValueByDirectionalPagingOnLoopDisabled(_configWithDefaults);\n };\n\n const getValueByIndexPaging = ({ index }: IndexPagingAnimationConfig): number => {\n if (index < 0 || index > lastIndex || index === currentIndex) {\n // no animation if index is invalid or equals to current index\n return 0;\n }\n\n const distance = Math.abs(currentIndex - index) * itemWidth;\n const direction = index > currentIndex ? -1 : 1;\n\n return distance * direction;\n };\n\n const wantedToValue = type === 'directional'\n // @ts-ignore\n ? getValueByDirectionalPaging(configWithDefaults)\n // @ts-ignore\n : getValueByIndexPaging(configWithDefaults);\n\n const toValue = compensateToValue(wantedToValue, currentOffsetRef.current);\n\n toValueRef.current = toValue;\n isAnimatingRef.current = true;\n\n notifyScrollStateHasChanged({\n offset: currentOffsetRef.current + toValue,\n state: 'dragging',\n });\n\n const lastGestureTranslationX: number = configWithDefaults.lastGestureTranslationX ?? 0;\n if (Number.isFinite(lastGestureTranslationX)) {\n animationOffsetX.setValue(lastGestureTranslationX);\n gestureTranslationX.setValue(0);\n }\n\n if (configWithDefaults.animated) {\n const animation = createScrollAnimation(animationOffsetX, toValue);\n\n animation.start(({ finished }) => {\n if (finished) {\n finalizeAnimation();\n }\n });\n } else {\n finalizeAnimation();\n }\n }, [\n createScrollAnimation,\n getCurrentIndex,\n finalizeAnimation,\n itemWidth,\n lastIndex,\n loop,\n notifyScrollStateHasChanged,\n ]);\n\n return {\n gestureTranslationX,\n globalInterpolation,\n interruptAnimation,\n startPagingAnimation,\n };\n};\n"],"mappings":"AAAA,SAASA,WAAT,EAAsBC,OAAtB,EAA+BC,MAA/B,QAA6C,OAA7C;AACA,SAASC,QAAT,QAAyB,cAAzB;AACA,SAASC,gBAAT,QAAiC,mBAAjC;;AA4BA,SAASC,gBAAT,CAA0BC,SAA1B,EAA6C;EACzC,OAAO,UAAUC,SAAV,EAA8C;IACjD,QAAQA,SAAR;MACI,KAAK,MAAL;QACI,OAAO,CAACD,SAAR;;MACJ,KAAK,MAAL;QACI,OAAOA,SAAP;;MACJ,KAAK,MAAL;QACI,OAAO,CAAP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GAAyB,IAAzB;IAEAlB,2BAA2B,CAAC;MACxBY,MAAM,EAAEJ,gBAAgB,CAACU,OAAjB,GAA2BlC,OADX;MAExByC,KAAK,EAAE;IAFiB,CAAD,CAA3B;IAKA,MAAMkB,uBAA+B,GAAGd,kBAAkB,CAACc,uBAAnB,IAA8C,CAAtF;;IACA,IAAIC,MAAM,CAACC,QAAP,CAAgBF,uBAAhB,CAAJ,EAA8C;MAC1CxC,gBAAgB,CAACgB,QAAjB,CAA0BwB,uBAA1B;MACAvC,mBAAmB,CAACe,QAApB,CAA6B,CAA7B;IACH;;IAED,IAAIU,kBAAkB,CAACC,QAAvB,EAAiC;MAC7B,MAAMgB,SAAS,GAAGrD,qBAAqB,CAACU,gBAAD,EAAmBnB,OAAnB,CAAvC;MAEA8D,SAAS,CAACC,KAAV,CAAgB,SAAkB;QAAA,IAAjB;UAAEC;QAAF,CAAiB;;QAC9B,IAAIA,QAAJ,EAAc;UACVtB,iBAAiB;QACpB;MACJ,CAJD;IAKH,CARD,MAQO;MACHA,iBAAiB;IACpB;EACJ,CAtFuC,EAsFrC,CACCjC,qBADD,EAECK,eAFD,EAGC4B,iBAHD,EAIC7C,SAJD,EAKCkB,SALD,EAMCH,IAND,EAOCI,2BAPD,CAtFqC,CAAxC;EAgGA,OAAO;IACHI,mBADG;IAEHC,mBAFG;IAGHe,kBAHG;IAIHO;EAJG,CAAP;AAMH;AAAA"}
|
|
1
|
+
{"version":3,"names":["useCallback","useMemo","useRef","Animated","useAnimatedValue","directionToValue","itemWidth","direction","toValueCompensator","toValue","currentOffset","remainder","Math","abs","halfOfItemWidth","compensateVector","usePagingAnimator","config","createScrollAnimation","indexController","initialIndex","loop","numberOfData","getCurrentIndex","lastIndex","notifyScrollStateHasChanged","initialOffsetX","accumulativeOffsetX","animationOffsetX","gestureTranslationX","globalInterpolation","add","toValueRef","currentOffsetRef","isAnimatingRef","maxWidth","ensureOffsetBoundary","offset","isCloseToEnd","signOfOffset","requireNewOffset","newOffset","nextOffset","current","setValue","interruptAnimation","stopAnimation","lastValue","prevOffset","totalOffset","state","finalizeAnimation","startPagingAnimation","type","configWithDefaults","animated","currentIndex","getValueByDirectionOnAllAdjacentItemsVisible","compensateToValue","getValueByDirectionalPagingOnLoopDisabled","_config","isOriginatedFromGesture","getValueByDirectionalPaging","_configWithDefaults","getValueByIndexPaging","index","distance","wantedToValue","lastGestureTranslationX","Number","isFinite","animation","start","finished"],"sources":["usePagingAnimator.ts"],"sourcesContent":["import { useCallback, useMemo, useRef } from 'react';\nimport { Animated } from 'react-native';\nimport { useAnimatedValue } from '@fountain-ui/core';\nimport type {\n CreateScrollAnimation,\n DirectionalPagingAnimationConfig,\n IndexController,\n IndexPagingAnimationConfig,\n PagingAnimationConfig,\n PagingAnimationType,\n PagingDirection,\n StartPagingAnimation,\n} from '../types';\n\nexport interface PagingAnimatorConfig {\n createScrollAnimation: CreateScrollAnimation;\n itemWidth: number;\n indexController: IndexController;\n initialIndex: number;\n loop: boolean;\n numberOfData: number;\n}\n\nexport interface PagingAnimator {\n gestureTranslationX: Animated.Value;\n globalInterpolation: Animated.AnimatedInterpolation<string>;\n interruptAnimation: () => void;\n startPagingAnimation: StartPagingAnimation;\n}\n\nfunction directionToValue(itemWidth: number) {\n return function (direction: PagingDirection): number {\n switch (direction) {\n case 'next':\n return -itemWidth;\n case 'prev':\n return itemWidth;\n case 'stay':\n return 0;\n }\n };\n}\n\nfunction toValueCompensator(itemWidth: number) {\n return function (toValue: number, currentOffset: number): number {\n const remainder = Math.abs(currentOffset % itemWidth);\n\n const halfOfItemWidth = Math.abs(itemWidth / 2);\n const compensateVector = remainder > halfOfItemWidth\n ? remainder - itemWidth\n : remainder;\n\n const direction = currentOffset > 0 ? -1 : 1;\n\n return toValue + (direction * compensateVector);\n };\n}\n\nexport default function usePagingAnimator(config: PagingAnimatorConfig): PagingAnimator {\n const {\n createScrollAnimation,\n itemWidth,\n indexController,\n initialIndex,\n loop,\n numberOfData,\n } = config;\n\n const {\n getCurrentIndex,\n lastIndex,\n notifyScrollStateHasChanged,\n } = indexController;\n\n const initialOffsetX = itemWidth * initialIndex;\n const accumulativeOffsetX = useAnimatedValue(initialOffsetX);\n const animationOffsetX = useAnimatedValue(0);\n const gestureTranslationX = useAnimatedValue(0);\n\n const globalInterpolation = useMemo(() => {\n return Animated.add(\n Animated.add(accumulativeOffsetX, animationOffsetX),\n gestureTranslationX,\n );\n }, []);\n\n const toValueRef = useRef<number>(0);\n const currentOffsetRef = useRef<number>(0);\n\n const isAnimatingRef = useRef<boolean>(false);\n\n const maxWidth = Math.abs(numberOfData * itemWidth);\n\n const ensureOffsetBoundary: (offset: number) => number = useCallback((offset: number) => {\n if (loop) {\n const isCloseToEnd = Math.abs(offset) >= (maxWidth - itemWidth);\n if (isCloseToEnd) {\n const signOfOffset = offset > 0 ? 1 : -1;\n return offset + (-signOfOffset * maxWidth);\n }\n }\n\n return offset % maxWidth;\n }, [itemWidth, loop, maxWidth]);\n\n const requireNewOffset = useCallback((newOffset: number) => {\n const nextOffset = ensureOffsetBoundary(newOffset);\n\n currentOffsetRef.current = nextOffset;\n accumulativeOffsetX.setValue(nextOffset);\n\n toValueRef.current = 0;\n animationOffsetX.setValue(0);\n }, [\n ensureOffsetBoundary,\n ]);\n\n const interruptAnimation = useCallback(() => {\n if (!isAnimatingRef.current) {\n return;\n }\n\n animationOffsetX.stopAnimation(lastValue => {\n isAnimatingRef.current = false;\n\n const prevOffset = currentOffsetRef.current;\n const totalOffset = prevOffset + lastValue;\n\n requireNewOffset(totalOffset);\n\n notifyScrollStateHasChanged({ offset: totalOffset, state: 'interrupted' });\n });\n }, [\n notifyScrollStateHasChanged,\n requireNewOffset,\n ]);\n\n const finalizeAnimation = useCallback(() => {\n isAnimatingRef.current = false;\n\n const prevOffset = currentOffsetRef.current;\n const toValue = toValueRef.current;\n const totalOffset = prevOffset + toValue;\n\n requireNewOffset(totalOffset);\n\n notifyScrollStateHasChanged({ offset: totalOffset, state: 'idle' });\n }, [\n notifyScrollStateHasChanged,\n requireNewOffset,\n ]);\n\n const startPagingAnimation = useCallback((type: PagingAnimationType, config: PagingAnimationConfig) => {\n if (isAnimatingRef.current) {\n return;\n }\n\n const configWithDefaults: PagingAnimationConfig = {\n animated: true,\n ...config,\n };\n\n const currentIndex = getCurrentIndex();\n\n const getValueByDirectionOnAllAdjacentItemsVisible = directionToValue(itemWidth);\n const compensateToValue = toValueCompensator(itemWidth);\n\n const getValueByDirectionalPagingOnLoopDisabled = (_config: DirectionalPagingAnimationConfig): number => {\n const { direction, isOriginatedFromGesture } = _config;\n\n if (currentIndex === 0 && direction === 'prev') {\n return isOriginatedFromGesture\n ? getValueByDirectionOnAllAdjacentItemsVisible('stay')\n : -lastIndex * itemWidth; // last position\n } else if (currentIndex === lastIndex && direction === 'next') {\n return isOriginatedFromGesture\n ? getValueByDirectionOnAllAdjacentItemsVisible('stay')\n : lastIndex * itemWidth; // first position\n }\n return getValueByDirectionOnAllAdjacentItemsVisible(direction);\n };\n\n const getValueByDirectionalPaging = (_config: DirectionalPagingAnimationConfig): number => {\n const _configWithDefaults: DirectionalPagingAnimationConfig = {\n isOriginatedFromGesture: false,\n ..._config,\n };\n\n return loop\n ? getValueByDirectionOnAllAdjacentItemsVisible(_configWithDefaults.direction)\n : getValueByDirectionalPagingOnLoopDisabled(_configWithDefaults);\n };\n\n const getValueByIndexPaging = ({ index }: IndexPagingAnimationConfig): number => {\n if (index < 0 || index > lastIndex || index === currentIndex) {\n // no animation if index is invalid or equals to current index\n return 0;\n }\n\n const distance = Math.abs(currentIndex - index) * itemWidth;\n const direction = index > currentIndex ? -1 : 1;\n\n return distance * direction;\n };\n\n const wantedToValue = type === 'directional'\n // @ts-ignore\n ? getValueByDirectionalPaging(configWithDefaults)\n // @ts-ignore\n : getValueByIndexPaging(configWithDefaults);\n\n const toValue = compensateToValue(wantedToValue, currentOffsetRef.current);\n\n toValueRef.current = toValue;\n isAnimatingRef.current = true;\n\n notifyScrollStateHasChanged({\n offset: currentOffsetRef.current + toValue,\n state: 'dragging',\n });\n\n const lastGestureTranslationX: number = configWithDefaults.lastGestureTranslationX ?? 0;\n if (Number.isFinite(lastGestureTranslationX)) {\n animationOffsetX.setValue(lastGestureTranslationX);\n gestureTranslationX.setValue(0);\n }\n\n if (configWithDefaults.animated) {\n const animation = createScrollAnimation(animationOffsetX, toValue);\n\n animation.start(({ finished }) => {\n if (finished) {\n finalizeAnimation();\n }\n });\n } else {\n finalizeAnimation();\n }\n }, [\n createScrollAnimation,\n getCurrentIndex,\n finalizeAnimation,\n itemWidth,\n lastIndex,\n loop,\n notifyScrollStateHasChanged,\n ]);\n\n return {\n gestureTranslationX,\n globalInterpolation,\n interruptAnimation,\n startPagingAnimation,\n };\n};\n"],"mappings":"AAAA,SAASA,WAAT,EAAsBC,OAAtB,EAA+BC,MAA/B,QAA6C,OAA7C;AACA,SAASC,QAAT,QAAyB,cAAzB;AACA,SAASC,gBAAT,QAAiC,mBAAjC;;AA4BA,SAASC,gBAAT,CAA0BC,SAA1B,EAA6C;EACzC,OAAO,UAAUC,SAAV,EAA8C;IACjD,QAAQA,SAAR;MACI,KAAK,MAAL;QACI,OAAO,CAACD,SAAR;;MACJ,KAAK,MAAL;QACI,OAAOA,SAAP;;MACJ,KAAK,MAAL;QACI,OAAO,CAAP;IANR;EAQH,CATD;AAUH;;AAED,SAASE,kBAAT,CAA4BF,SAA5B,EAA+C;EAC3C,OAAO,UAAUG,OAAV,EAA2BC,aAA3B,EAA0D;IAC7D,MAAMC,SAAS,GAAGC,IAAI,CAACC,GAAL,CAASH,aAAa,GAAGJ,SAAzB,CAAlB;IAEA,MAAMQ,eAAe,GAAGF,IAAI,CAACC,GAAL,CAASP,SAAS,GAAG,CAArB,CAAxB;IACA,MAAMS,gBAAgB,GAAGJ,SAAS,GAAGG,eAAZ,GACnBH,SAAS,GAAGL,SADO,GAEnBK,SAFN;IAIA,MAAMJ,SAAS,GAAGG,aAAa,GAAG,CAAhB,GAAoB,CAAC,CAArB,GAA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rD,qBAAqB,CAACU,gBAAD,EAAmBnB,OAAnB,CAAvC;MAEA8D,SAAS,CAACC,KAAV,CAAgB,SAAkB;QAAA,IAAjB;UAAEC;QAAF,CAAiB;;QAC9B,IAAIA,QAAJ,EAAc;UACVtB,iBAAiB;QACpB;MACJ,CAJD;IAKH,CARD,MAQO;MACHA,iBAAiB;IACpB;EACJ,CAtFuC,EAsFrC,CACCjC,qBADD,EAECK,eAFD,EAGC4B,iBAHD,EAIC7C,SAJD,EAKCkB,SALD,EAMCH,IAND,EAOCI,2BAPD,CAtFqC,CAAxC;EAgGA,OAAO;IACHI,mBADG;IAEHC,mBAFG;IAGHe,kBAHG;IAIHO;EAJG,CAAP;AAMH;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["directions","scrollStates"],"sources":["types.ts"],"sourcesContent":["import type { ReactElement } from 'react';\nimport type { Animated, ViewProps } from 'react-native';\n\nconst directions = ['next', 'prev', 'stay'] as const;\n\nexport type PagingDirection = (typeof directions)[number];\n\nconst scrollStates = ['idle', 'dragging', 'interrupted'] as const;\n\nexport type ScrollState = (typeof scrollStates)[number];\n\nexport type ItemHeight = number | 'auto';\n\nexport interface RenderItem<T> {\n (info: { item: T, index: number, interpolation: Animated.AnimatedInterpolation }): ReactElement | null;\n}\n\nexport interface CreateScrollAnimation {\n (aValue: Animated.AnimatedValue, toValue: number): Animated.CompositeAnimation;\n}\n\nexport interface CreateItemStyle {\n (itemInterpolation: Animated.AnimatedInterpolation
|
|
1
|
+
{"version":3,"names":["directions","scrollStates"],"sources":["types.ts"],"sourcesContent":["import type { ReactElement } from 'react';\nimport type { Animated, ViewProps } from 'react-native';\n\nconst directions = ['next', 'prev', 'stay'] as const;\n\nexport type PagingDirection = (typeof directions)[number];\n\nconst scrollStates = ['idle', 'dragging', 'interrupted'] as const;\n\nexport type ScrollState = (typeof scrollStates)[number];\n\nexport type ItemHeight = number | 'auto';\n\nexport interface RenderItem<T> {\n (info: { item: T, index: number, interpolation: Animated.AnimatedInterpolation<string> }): ReactElement | null;\n}\n\nexport interface CreateScrollAnimation {\n (aValue: Animated.AnimatedValue, toValue: number): Animated.CompositeAnimation;\n}\n\nexport interface CreateItemStyle {\n (itemInterpolation: Animated.AnimatedInterpolation<string>, itemWidth: number): Animated.AnimatedProps<ViewProps['style']>;\n}\n\nexport interface GetCurrentIndex {\n (): number;\n}\n\nexport interface OnIndexChange {\n (itemIndex: number): void;\n}\n\nexport interface OnPositionChange {\n (position: number): void;\n}\n\nexport interface ScrollStateChangeEvent {\n offset: number;\n state: ScrollState;\n}\n\nexport interface IndexController {\n getCurrentIndex: GetCurrentIndex;\n lastIndex: number;\n notifyScrollStateHasChanged: (event: ScrollStateChangeEvent) => void;\n}\n\nexport type PagingAnimationType = 'directional' | 'index';\n\nexport interface BasePagingAnimationConfig {\n animated?: boolean;\n lastGestureTranslationX?: number;\n}\n\nexport interface DirectionalPagingAnimationConfig extends BasePagingAnimationConfig {\n direction: PagingDirection;\n isOriginatedFromGesture?: boolean;\n}\n\nexport interface IndexPagingAnimationConfig extends BasePagingAnimationConfig {\n index: number;\n}\n\nexport type PagingAnimationConfig = DirectionalPagingAnimationConfig | IndexPagingAnimationConfig;\n\nexport interface StartPagingAnimation {\n (type: PagingAnimationType, config: PagingAnimationConfig): void;\n}\n\nexport type VisibleIndexRanges = Array<[number, number]>;\n\nexport interface StoreSubscription {\n (): void;\n}\n\nexport interface ItemVisibilityStore {\n dispatch: (ranges: VisibleIndexRanges) => void;\n subscribe: (listener: (ranges: VisibleIndexRanges) => void) => StoreSubscription;\n removeAllListeners: () => void;\n}\n\nexport interface AutoplayController {\n pause: () => void;\n resume: () => void;\n}\n\nexport interface ScrollToOption {\n index: number;\n animated?: boolean;\n}\n\nexport interface CarouselInstance {\n /**\n * Get current visible item index.\n */\n getCurrentIndex: GetCurrentIndex;\n\n /**\n * Scroll to next visible item.\n */\n next: () => void;\n\n /**\n * Scroll to previous visible item.\n */\n prev: () => void;\n\n /**\n * Scroll to desired indexed item.\n * Invalid index is ignored.\n */\n scrollTo: (option: ScrollToOption) => void;\n}\n"],"mappings":"AAGA,MAAMA,UAAU,GAAG,CAAC,MAAD,EAAS,MAAT,EAAiB,MAAjB,CAAnB;AAIA,MAAMC,YAAY,GAAG,CAAC,MAAD,EAAS,UAAT,EAAqB,aAArB,CAArB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Image","TouchableWithoutFeedback","View","css","FuiImage","ReloadButton","EncodedTile","ViewerItem","props","height","url","width","imageKey","invisiblePaddingTop","onError","onLoad","onPress","onReloadPress","reloadButtonVisible","styles","view","paddingTop","image","error","placeholder","uri","alignSelf"],"sources":["ViewerItem.tsx"],"sourcesContent":["import React from 'react';\nimport { Image, TouchableWithoutFeedback, View } from 'react-native';\nimport { css, Image as FuiImage, ImageProps } from '@fountain-ui/core';\nimport ReloadButton from './ReloadButton';\nimport EncodedTile from './EncodedTile';\n\nexport interface ViewerItemProps {\n /**\n * Image width.\n */\n width: number;\n\n /**\n * Image height.\n */\n height: number;\n\n /**\n * Need invisible paddingTop viewer vertically expanded.\n */\n invisiblePaddingTop: number;\n\n /**\n * Image sourceUrl for displaying.\n */\n url?: string;\n\n /**\n * Error handler.\n */\n onError?: ImageProps['onError'];\n\n /**\n * Load handler.\n */\n onLoad?: ImageProps['onLoad'];\n\n /**\n * Handle Reload button press event.\n */\n onReloadPress?: ImageProps['onError'];\n\n /**\n * Handle item press event.\n */\n onPress?: () => void;\n\n /**\n * If true, reload button visible.\n * @default false\n */\n reloadButtonVisible?: boolean;\n\n /**\n * FuiImage key for trigger image rerender.\n */\n imageKey: string;\n}\n\nexport default function ViewerItem(props: ViewerItemProps) {\n const {\n height,\n url,\n width,\n imageKey,\n invisiblePaddingTop,\n onError,\n onLoad,\n onPress,\n onReloadPress,\n reloadButtonVisible = false,\n } = props;\n\n const styles = {\n view: {\n height,\n width: '100%',\n paddingTop: invisiblePaddingTop,\n },\n image: {\n height: height - invisiblePaddingTop,\n width,\n },\n };\n\n const error = reloadButtonVisible ? <ReloadButton onPress={onReloadPress}/> : null;\n\n const placeholder = <Image\n source={{ uri: EncodedTile }}\n resizeMode={'cover'}\n style={styles.image}\n />;\n\n return (\n <TouchableWithoutFeedback onPress={onPress}>\n <View style={styles.view}>\n <FuiImage\n key={imageKey}\n cache={'web'}\n disableDrag={true}\n disableLongClick={true}\n disableOutline={true}\n error={error}\n onError={onError}\n onLoad={onLoad}\n loading={'eager'}\n placeholder={placeholder}\n source={{ uri: url }}\n square={true}\n style={css([\n { alignSelf: 'center' },\n styles.image,\n ])}\n />\n </View>\n </TouchableWithoutFeedback>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,
|
|
1
|
+
{"version":3,"names":["React","Image","TouchableWithoutFeedback","View","css","FuiImage","ReloadButton","EncodedTile","ViewerItem","props","height","url","width","imageKey","invisiblePaddingTop","onError","onLoad","onPress","onReloadPress","reloadButtonVisible","styles","view","paddingTop","image","error","placeholder","uri","alignSelf"],"sources":["ViewerItem.tsx"],"sourcesContent":["import React from 'react';\nimport { DimensionValue, Image, TouchableWithoutFeedback, View } from 'react-native';\nimport { css, Image as FuiImage, ImageProps } from '@fountain-ui/core';\nimport ReloadButton from './ReloadButton';\nimport EncodedTile from './EncodedTile';\n\nexport interface ViewerItemProps {\n /**\n * Image width.\n */\n width: number;\n\n /**\n * Image height.\n */\n height: number;\n\n /**\n * Need invisible paddingTop viewer vertically expanded.\n */\n invisiblePaddingTop: number;\n\n /**\n * Image sourceUrl for displaying.\n */\n url?: string;\n\n /**\n * Error handler.\n */\n onError?: ImageProps['onError'];\n\n /**\n * Load handler.\n */\n onLoad?: ImageProps['onLoad'];\n\n /**\n * Handle Reload button press event.\n */\n onReloadPress?: ImageProps['onError'];\n\n /**\n * Handle item press event.\n */\n onPress?: () => void;\n\n /**\n * If true, reload button visible.\n * @default false\n */\n reloadButtonVisible?: boolean;\n\n /**\n * FuiImage key for trigger image rerender.\n */\n imageKey: string;\n}\n\nexport default function ViewerItem(props: ViewerItemProps) {\n const {\n height,\n url,\n width,\n imageKey,\n invisiblePaddingTop,\n onError,\n onLoad,\n onPress,\n onReloadPress,\n reloadButtonVisible = false,\n } = props;\n\n const styles = {\n view: {\n height,\n width: '100%' as DimensionValue,\n paddingTop: invisiblePaddingTop,\n },\n image: {\n height: height - invisiblePaddingTop,\n width,\n },\n };\n\n const error = reloadButtonVisible ? <ReloadButton onPress={onReloadPress}/> : null;\n\n const placeholder = <Image\n source={{ uri: EncodedTile }}\n resizeMode={'cover'}\n style={styles.image}\n />;\n\n return (\n <TouchableWithoutFeedback onPress={onPress}>\n <View style={styles.view}>\n <FuiImage\n key={imageKey}\n cache={'web'}\n disableDrag={true}\n disableLongClick={true}\n disableOutline={true}\n error={error}\n onError={onError}\n onLoad={onLoad}\n loading={'eager'}\n placeholder={placeholder}\n source={{ uri: url }}\n square={true}\n style={css([\n { alignSelf: 'center' },\n styles.image,\n ])}\n />\n </View>\n </TouchableWithoutFeedback>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAAyBC,KAAzB,EAAgCC,wBAAhC,EAA0DC,IAA1D,QAAsE,cAAtE;AACA,SAASC,GAAT,EAAcH,KAAK,IAAII,QAAvB,QAAmD,mBAAnD;AACA,OAAOC,YAAP,MAAyB,gBAAzB;AACA,OAAOC,WAAP,MAAwB,eAAxB;AAuDA,eAAe,SAASC,UAAT,CAAoBC,KAApB,EAA4C;EACvD,MAAM;IACFC,MADE;IAEFC,GAFE;IAGFC,KAHE;IAIFC,QAJE;IAKFC,mBALE;IAMFC,OANE;IAOFC,MAPE;IAQFC,OARE;IASFC,aATE;IAUFC,mBAAmB,GAAG;EAVpB,IAWFV,KAXJ;EAaA,MAAMW,MAAM,GAAG;IACXC,IAAI,EAAE;MACFX,MADE;MAEFE,KAAK,EAAE,MAFL;MAGFU,UAAU,EAAER;IAHV,CADK;IAMXS,KAAK,EAAE;MACHb,MAAM,EAAEA,MAAM,GAAGI,mBADd;MAEHF;IAFG;EANI,CAAf;EAYA,MAAMY,KAAK,GAAGL,mBAAmB,gBAAG,oBAAC,YAAD;IAAc,OAAO,EAAED;EAAvB,EAAH,GAA6C,IAA9E;EAEA,MAAMO,WAAW,gBAAG,oBAAC,KAAD;IAChB,MAAM,EAAE;MAAEC,GAAG,EAAEnB;IAAP,CADQ;IAEhB,UAAU,EAAE,OAFI;IAGhB,KAAK,EAAEa,MAAM,CAACG;EAHE,EAApB;EAMA,oBACI,oBAAC,wBAAD;IAA0B,OAAO,EAAEN;EAAnC,gBACI,oBAAC,IAAD;IAAM,KAAK,EAAEG,MAAM,CAACC;EAApB,gBACI,oBAAC,QAAD;IACI,GAAG,EAAER,QADT;IAEI,KAAK,EAAE,KAFX;IAGI,WAAW,EAAE,IAHjB;IAII,gBAAgB,EAAE,IAJtB;IAKI,cAAc,EAAE,IALpB;IAMI,KAAK,EAAEW,KANX;IAOI,OAAO,EAAET,OAPb;IAQI,MAAM,EAAEC,MARZ;IASI,OAAO,EAAE,OATb;IAUI,WAAW,EAAES,WAVjB;IAWI,MAAM,EAAE;MAAEC,GAAG,EAAEf;IAAP,CAXZ;IAYI,MAAM,EAAE,IAZZ;IAaI,KAAK,EAAEP,GAAG,CAAC,CACP;MAAEuB,SAAS,EAAE;IAAb,CADO,EAEPP,MAAM,CAACG,KAFA,CAAD;EAbd,EADJ,CADJ,CADJ;AAwBH;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
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:
|
|
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: ArrayLike<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={'strong'}\n variant={'body3'}\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,OAAT,EAAkBC,OAAlB,QAAiC,UAAjC;AAEA,SAASC,MAAT,EAAiBC,MAAjB,EAAyBC,UAAzB,EAAqCC,QAArC,QAAqD,mBAArD;AACA,SAASC,UAAT,QAA2B,SAA3B;AAEA,MAAMC,QAAQ,GAAG,IAAjB;AACA,MAAMC,UAAU,GAAG,EAAnB;;AAYA,MAAMC,SAAsC,GAAG,YAA8B;EACzE,MAAMC,KAAK,GAAGL,QAAQ,EAAtB;EAEA,OAAO;IACHM,IAAI,EAAE;MACFC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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"}
|
|
@@ -4,7 +4,7 @@ import type { CreateItemStyle, ItemHeight, ItemVisibilityStore } from '../types'
|
|
|
4
4
|
export interface InternalContextValue<ItemT> {
|
|
5
5
|
createItemStyle: CreateItemStyle;
|
|
6
6
|
data: ReadonlyArray<ItemT>;
|
|
7
|
-
globalInterpolation: Animated.AnimatedInterpolation
|
|
7
|
+
globalInterpolation: Animated.AnimatedInterpolation<string>;
|
|
8
8
|
itemHeight: ItemHeight;
|
|
9
9
|
itemWidth: number;
|
|
10
10
|
itemVisibilityStore: ItemVisibilityStore;
|
|
@@ -2,7 +2,7 @@ import type { ReactElement } from 'react';
|
|
|
2
2
|
import type { ViewProps } from 'react-native';
|
|
3
3
|
import { Animated } from 'react-native';
|
|
4
4
|
export interface ItemViewProps {
|
|
5
|
-
children: (interpolation: Animated.AnimatedInterpolation) => ReactElement | null;
|
|
5
|
+
children: (interpolation: Animated.AnimatedInterpolation<string>) => ReactElement | null;
|
|
6
6
|
index: number;
|
|
7
7
|
onLayout?: ViewProps['onLayout'];
|
|
8
8
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Animated } from 'react-native';
|
|
2
|
-
export default function useItemInterpolation(index: number): Animated.AnimatedInterpolation
|
|
2
|
+
export default function useItemInterpolation(index: number): Animated.AnimatedInterpolation<string>;
|
|
@@ -10,7 +10,7 @@ export interface PagingAnimatorConfig {
|
|
|
10
10
|
}
|
|
11
11
|
export interface PagingAnimator {
|
|
12
12
|
gestureTranslationX: Animated.Value;
|
|
13
|
-
globalInterpolation: Animated.AnimatedInterpolation
|
|
13
|
+
globalInterpolation: Animated.AnimatedInterpolation<string>;
|
|
14
14
|
interruptAnimation: () => void;
|
|
15
15
|
startPagingAnimation: StartPagingAnimation;
|
|
16
16
|
}
|
|
@@ -9,14 +9,14 @@ export interface RenderItem<T> {
|
|
|
9
9
|
(info: {
|
|
10
10
|
item: T;
|
|
11
11
|
index: number;
|
|
12
|
-
interpolation: Animated.AnimatedInterpolation
|
|
12
|
+
interpolation: Animated.AnimatedInterpolation<string>;
|
|
13
13
|
}): ReactElement | null;
|
|
14
14
|
}
|
|
15
15
|
export interface CreateScrollAnimation {
|
|
16
16
|
(aValue: Animated.AnimatedValue, toValue: number): Animated.CompositeAnimation;
|
|
17
17
|
}
|
|
18
18
|
export interface CreateItemStyle {
|
|
19
|
-
(itemInterpolation: Animated.AnimatedInterpolation
|
|
19
|
+
(itemInterpolation: Animated.AnimatedInterpolation<string>, itemWidth: number): Animated.AnimatedProps<ViewProps['style']>;
|
|
20
20
|
}
|
|
21
21
|
export interface GetCurrentIndex {
|
|
22
22
|
(): number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fountain-ui/lab",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.25",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Fountain-UI Team",
|
|
6
6
|
"description": "Incubator for Fountain-UI React components.",
|
|
@@ -17,20 +17,20 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@emotion/react": "^11.10.0",
|
|
19
19
|
"@emotion/styled": "^11.10.0",
|
|
20
|
-
"@fountain-ui/icons": "3.0.0-alpha.
|
|
20
|
+
"@fountain-ui/icons": "3.0.0-alpha.14",
|
|
21
21
|
"@fountain-ui/utils": "^3.0.0-alpha.1",
|
|
22
22
|
"react-native-calendars": "1.1267.0"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@fountain-ui/core": "^3.0.0-alpha.1",
|
|
26
|
-
"@gorhom/bottom-sheet": "^
|
|
26
|
+
"@gorhom/bottom-sheet": "^5.0.0",
|
|
27
27
|
"date-fns": "^2.0.0",
|
|
28
28
|
"react": "^16.8.0 || ^17.0.0",
|
|
29
29
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
30
30
|
"react-native": "^0.63.0",
|
|
31
31
|
"react-native-gesture-handler": "^2.16.0",
|
|
32
32
|
"react-native-pager-view": "^4.0.0",
|
|
33
|
-
"react-native-safe-area-context": "
|
|
33
|
+
"react-native-safe-area-context": "5.1.0"
|
|
34
34
|
},
|
|
35
35
|
"peerDependenciesMeta": {
|
|
36
36
|
"@gorhom/bottom-sheet": {
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@gorhom/bottom-sheet": "^
|
|
47
|
+
"@gorhom/bottom-sheet": "^5.0.0",
|
|
48
48
|
"date-fns": "^2.23.0",
|
|
49
49
|
"react-native-pager-view": "^4.2.4",
|
|
50
|
-
"react-native-safe-area-context": "
|
|
50
|
+
"react-native-safe-area-context": "5.1.0"
|
|
51
51
|
},
|
|
52
52
|
"react-native-builder-bob": {
|
|
53
53
|
"source": "./src",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"publishConfig": {
|
|
72
72
|
"access": "public"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "e0a58a15b36ab1bc34163c1791d151214a89aac5"
|
|
75
75
|
}
|
|
@@ -12,7 +12,6 @@ import { Column, css, ExtendedStyle, isNotAndroid12, useAnimatedValue } from '@f
|
|
|
12
12
|
import { useTheme } from '@fountain-ui/styles';
|
|
13
13
|
import type BottomSheetProps from './BottomSheetProps';
|
|
14
14
|
import TransparentBackdrop from './TransparentBackdrop';
|
|
15
|
-
import useDynamicSnapPoints from './useDynamicSnapPoints.native';
|
|
16
15
|
|
|
17
16
|
const NoHandle = () => null;
|
|
18
17
|
|
|
@@ -134,13 +133,6 @@ export default function BottomSheet(props: BottomSheetProps) {
|
|
|
134
133
|
}).start();
|
|
135
134
|
};
|
|
136
135
|
|
|
137
|
-
const {
|
|
138
|
-
animatedHandleHeight,
|
|
139
|
-
animatedSnapPoints,
|
|
140
|
-
animatedContentHeight,
|
|
141
|
-
handleContentLayout,
|
|
142
|
-
} = useDynamicSnapPoints(snapPoints);
|
|
143
|
-
|
|
144
136
|
return (
|
|
145
137
|
<BottomSheetModalProvider>
|
|
146
138
|
<BottomSheetModal
|
|
@@ -158,9 +150,7 @@ export default function BottomSheet(props: BottomSheetProps) {
|
|
|
158
150
|
maxDynamicContentSize={maxDynamicContentSize}
|
|
159
151
|
detached={Boolean(topElement)}
|
|
160
152
|
onAnimate={topElement ? onAnimate : undefined}
|
|
161
|
-
snapPoints={
|
|
162
|
-
handleHeight={animatedHandleHeight}
|
|
163
|
-
contentHeight={animatedContentHeight}
|
|
153
|
+
snapPoints={snapPoints}
|
|
164
154
|
>
|
|
165
155
|
{topElement ? (
|
|
166
156
|
<Animated.View style={topElementAnimationStyle}>
|
|
@@ -173,10 +163,7 @@ export default function BottomSheet(props: BottomSheetProps) {
|
|
|
173
163
|
</Animated.View>
|
|
174
164
|
) : null}
|
|
175
165
|
|
|
176
|
-
<BottomSheetView
|
|
177
|
-
onLayout={handleContentLayout}
|
|
178
|
-
style={contentWrapperStyle}
|
|
179
|
-
>
|
|
166
|
+
<BottomSheetView style={contentWrapperStyle}>
|
|
180
167
|
{children}
|
|
181
168
|
</BottomSheetView>
|
|
182
169
|
</BottomSheetModal>
|
|
@@ -74,8 +74,6 @@ export default function BottomSheet(props: BottomSheetProps) {
|
|
|
74
74
|
}
|
|
75
75
|
};
|
|
76
76
|
|
|
77
|
-
const filteredSnapPoints = snapPoints.filter(point => point !== 'CONTENT_HEIGHT');
|
|
78
|
-
|
|
79
77
|
const {
|
|
80
78
|
convertedSnapPoints,
|
|
81
79
|
handleLayout,
|
|
@@ -83,7 +81,7 @@ export default function BottomSheet(props: BottomSheetProps) {
|
|
|
83
81
|
} = useDynamicSnapPoints({
|
|
84
82
|
enableDynamicSizing,
|
|
85
83
|
maxDynamicContentSize,
|
|
86
|
-
snapPoints
|
|
84
|
+
snapPoints,
|
|
87
85
|
});
|
|
88
86
|
|
|
89
87
|
const translateY = convertedSnapPoints.length > 0
|
|
@@ -5,7 +5,7 @@ import type { CreateItemStyle, ItemHeight, ItemVisibilityStore } from '../types'
|
|
|
5
5
|
export interface InternalContextValue<ItemT> {
|
|
6
6
|
createItemStyle: CreateItemStyle;
|
|
7
7
|
data: ReadonlyArray<ItemT>;
|
|
8
|
-
globalInterpolation: Animated.AnimatedInterpolation
|
|
8
|
+
globalInterpolation: Animated.AnimatedInterpolation<string>;
|
|
9
9
|
itemHeight: ItemHeight;
|
|
10
10
|
itemWidth: number;
|
|
11
11
|
itemVisibilityStore: ItemVisibilityStore;
|
|
@@ -7,7 +7,7 @@ import useItemInterpolation from './useItemInterpolation';
|
|
|
7
7
|
import InternalContext from './InternalContext';
|
|
8
8
|
|
|
9
9
|
export interface ItemViewProps {
|
|
10
|
-
children: (interpolation: Animated.AnimatedInterpolation) => ReactElement | null;
|
|
10
|
+
children: (interpolation: Animated.AnimatedInterpolation<string>) => ReactElement | null;
|
|
11
11
|
index: number;
|
|
12
12
|
onLayout?: ViewProps['onLayout'];
|
|
13
13
|
}
|
|
@@ -4,7 +4,7 @@ import InternalContext from './InternalContext';
|
|
|
4
4
|
|
|
5
5
|
const OVERSCROLL_FRICTION_FACTOR = 4;
|
|
6
6
|
|
|
7
|
-
export default function useItemInterpolation(index: number): Animated.AnimatedInterpolation {
|
|
7
|
+
export default function useItemInterpolation(index: number): Animated.AnimatedInterpolation<string> {
|
|
8
8
|
const {
|
|
9
9
|
itemWidth,
|
|
10
10
|
data,
|
|
@@ -23,7 +23,7 @@ export interface PagingAnimatorConfig {
|
|
|
23
23
|
|
|
24
24
|
export interface PagingAnimator {
|
|
25
25
|
gestureTranslationX: Animated.Value;
|
|
26
|
-
globalInterpolation: Animated.AnimatedInterpolation
|
|
26
|
+
globalInterpolation: Animated.AnimatedInterpolation<string>;
|
|
27
27
|
interruptAnimation: () => void;
|
|
28
28
|
startPagingAnimation: StartPagingAnimation;
|
|
29
29
|
}
|
package/src/Carousel/types.ts
CHANGED
|
@@ -12,7 +12,7 @@ export type ScrollState = (typeof scrollStates)[number];
|
|
|
12
12
|
export type ItemHeight = number | 'auto';
|
|
13
13
|
|
|
14
14
|
export interface RenderItem<T> {
|
|
15
|
-
(info: { item: T, index: number, interpolation: Animated.AnimatedInterpolation }): ReactElement | null;
|
|
15
|
+
(info: { item: T, index: number, interpolation: Animated.AnimatedInterpolation<string> }): ReactElement | null;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export interface CreateScrollAnimation {
|
|
@@ -20,7 +20,7 @@ export interface CreateScrollAnimation {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export interface CreateItemStyle {
|
|
23
|
-
(itemInterpolation: Animated.AnimatedInterpolation
|
|
23
|
+
(itemInterpolation: Animated.AnimatedInterpolation<string>, itemWidth: number): Animated.AnimatedProps<ViewProps['style']>;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export interface GetCurrentIndex {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Image, TouchableWithoutFeedback, View } from 'react-native';
|
|
2
|
+
import { DimensionValue, Image, TouchableWithoutFeedback, View } from 'react-native';
|
|
3
3
|
import { css, Image as FuiImage, ImageProps } from '@fountain-ui/core';
|
|
4
4
|
import ReloadButton from './ReloadButton';
|
|
5
5
|
import EncodedTile from './EncodedTile';
|
|
@@ -74,7 +74,7 @@ export default function ViewerItem(props: ViewerItemProps) {
|
|
|
74
74
|
const styles = {
|
|
75
75
|
view: {
|
|
76
76
|
height,
|
|
77
|
-
width: '100%',
|
|
77
|
+
width: '100%' as DimensionValue,
|
|
78
78
|
paddingTop: invisiblePaddingTop,
|
|
79
79
|
},
|
|
80
80
|
image: {
|
|
@@ -51,7 +51,7 @@ const YearPicker = ({
|
|
|
51
51
|
});
|
|
52
52
|
}, [date]);
|
|
53
53
|
|
|
54
|
-
const getItemLayout = (data:
|
|
54
|
+
const getItemLayout = (data: ArrayLike<number> | null | undefined, index: number) => ({
|
|
55
55
|
length: itemHeight,
|
|
56
56
|
offset: itemHeight * index,
|
|
57
57
|
index,
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = useDynamicSnapPoints;
|
|
7
|
-
|
|
8
|
-
var _bottomSheet = require("@gorhom/bottom-sheet");
|
|
9
|
-
|
|
10
|
-
function useDynamicSnapPoints(snapPoints) {
|
|
11
|
-
if (snapPoints !== null && snapPoints !== void 0 && snapPoints.includes('CONTENT_HEIGHT')) {
|
|
12
|
-
return (0, _bottomSheet.useBottomSheetDynamicSnapPoints)(snapPoints);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
return {
|
|
16
|
-
animatedHandleHeight: undefined,
|
|
17
|
-
animatedSnapPoints: snapPoints,
|
|
18
|
-
animatedContentHeight: undefined,
|
|
19
|
-
handleContentLayout: undefined
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=useDynamicSnapPoints.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useDynamicSnapPoints","snapPoints","includes","useBottomSheetDynamicSnapPoints","animatedHandleHeight","undefined","animatedSnapPoints","animatedContentHeight","handleContentLayout"],"sources":["useDynamicSnapPoints.native.ts"],"sourcesContent":["import { useBottomSheetDynamicSnapPoints } from '@gorhom/bottom-sheet';\nimport type BottomSheetProps from './BottomSheetProps';\n\nexport default function useDynamicSnapPoints(snapPoints: BottomSheetProps['snapPoints']) {\n if (snapPoints?.includes('CONTENT_HEIGHT')) {\n return useBottomSheetDynamicSnapPoints(snapPoints);\n }\n\n return {\n animatedHandleHeight: undefined,\n animatedSnapPoints: snapPoints,\n animatedContentHeight: undefined,\n handleContentLayout: undefined,\n };\n}\n"],"mappings":";;;;;;;AAAA;;AAGe,SAASA,oBAAT,CAA8BC,UAA9B,EAA0E;EACrF,IAAIA,UAAJ,aAAIA,UAAJ,eAAIA,UAAU,CAAEC,QAAZ,CAAqB,gBAArB,CAAJ,EAA4C;IACxC,OAAO,IAAAC,4CAAA,EAAgCF,UAAhC,CAAP;EACH;;EAED,OAAO;IACHG,oBAAoB,EAAEC,SADnB;IAEHC,kBAAkB,EAAEL,UAFjB;IAGHM,qBAAqB,EAAEF,SAHpB;IAIHG,mBAAmB,EAAEH;EAJlB,CAAP;AAMH"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { useBottomSheetDynamicSnapPoints } from '@gorhom/bottom-sheet';
|
|
2
|
-
export default function useDynamicSnapPoints(snapPoints) {
|
|
3
|
-
if (snapPoints !== null && snapPoints !== void 0 && snapPoints.includes('CONTENT_HEIGHT')) {
|
|
4
|
-
return useBottomSheetDynamicSnapPoints(snapPoints);
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
return {
|
|
8
|
-
animatedHandleHeight: undefined,
|
|
9
|
-
animatedSnapPoints: snapPoints,
|
|
10
|
-
animatedContentHeight: undefined,
|
|
11
|
-
handleContentLayout: undefined
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=useDynamicSnapPoints.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useBottomSheetDynamicSnapPoints","useDynamicSnapPoints","snapPoints","includes","animatedHandleHeight","undefined","animatedSnapPoints","animatedContentHeight","handleContentLayout"],"sources":["useDynamicSnapPoints.native.ts"],"sourcesContent":["import { useBottomSheetDynamicSnapPoints } from '@gorhom/bottom-sheet';\nimport type BottomSheetProps from './BottomSheetProps';\n\nexport default function useDynamicSnapPoints(snapPoints: BottomSheetProps['snapPoints']) {\n if (snapPoints?.includes('CONTENT_HEIGHT')) {\n return useBottomSheetDynamicSnapPoints(snapPoints);\n }\n\n return {\n animatedHandleHeight: undefined,\n animatedSnapPoints: snapPoints,\n animatedContentHeight: undefined,\n handleContentLayout: undefined,\n };\n}\n"],"mappings":"AAAA,SAASA,+BAAT,QAAgD,sBAAhD;AAGA,eAAe,SAASC,oBAAT,CAA8BC,UAA9B,EAA0E;EACrF,IAAIA,UAAJ,aAAIA,UAAJ,eAAIA,UAAU,CAAEC,QAAZ,CAAqB,gBAArB,CAAJ,EAA4C;IACxC,OAAOH,+BAA+B,CAACE,UAAD,CAAtC;EACH;;EAED,OAAO;IACHE,oBAAoB,EAAEC,SADnB;IAEHC,kBAAkB,EAAEJ,UAFjB;IAGHK,qBAAqB,EAAEF,SAHpB;IAIHG,mBAAmB,EAAEH;EAJlB,CAAP;AAMH"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/// <reference types="react-native-reanimated" />
|
|
2
|
-
import type BottomSheetProps from './BottomSheetProps';
|
|
3
|
-
export default function useDynamicSnapPoints(snapPoints: BottomSheetProps['snapPoints']): {
|
|
4
|
-
animatedSnapPoints: Readonly<{
|
|
5
|
-
value: (string | number)[];
|
|
6
|
-
}>;
|
|
7
|
-
animatedHandleHeight: import("react-native-reanimated").SharedValue<number>;
|
|
8
|
-
animatedContentHeight: import("react-native-reanimated").SharedValue<number>;
|
|
9
|
-
handleContentLayout: ({ nativeEvent: { layout: { height }, }, }: {
|
|
10
|
-
nativeEvent: {
|
|
11
|
-
layout: {
|
|
12
|
-
height: number;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
}) => void;
|
|
16
|
-
} | {
|
|
17
|
-
animatedHandleHeight: undefined;
|
|
18
|
-
animatedSnapPoints: (string | number)[] | undefined;
|
|
19
|
-
animatedContentHeight: undefined;
|
|
20
|
-
handleContentLayout: undefined;
|
|
21
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { useBottomSheetDynamicSnapPoints } from '@gorhom/bottom-sheet';
|
|
2
|
-
import type BottomSheetProps from './BottomSheetProps';
|
|
3
|
-
|
|
4
|
-
export default function useDynamicSnapPoints(snapPoints: BottomSheetProps['snapPoints']) {
|
|
5
|
-
if (snapPoints?.includes('CONTENT_HEIGHT')) {
|
|
6
|
-
return useBottomSheetDynamicSnapPoints(snapPoints);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
return {
|
|
10
|
-
animatedHandleHeight: undefined,
|
|
11
|
-
animatedSnapPoints: snapPoints,
|
|
12
|
-
animatedContentHeight: undefined,
|
|
13
|
-
handleContentLayout: undefined,
|
|
14
|
-
};
|
|
15
|
-
}
|