{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "native-internal-hook-use-popup-bottom-sheet-content-animation", "type": "registry:hook", "title": "Use Popup Bottom Sheet Content Animation", "description": "Use Popup Bottom Sheet Content Animation from @pitsi-ui/native for native projects.", "dependencies": [ "react-native-reanimated@^4.1.1" ], "registryDependencies": [], "files": [ { "path": "registry/native-ui/src/helpers/internal/hooks/use-popup-bottom-sheet-content-animation.ts", "content": "import type { SharedValue } from \"react-native-reanimated\";\nimport {\n Extrapolation,\n interpolate,\n useAnimatedReaction,\n useSharedValue,\n} from \"react-native-reanimated\";\n\n/**\n * Props for usePopupBottomSheetContentAnimation hook\n */\nexport interface UsePopupBottomSheetContentAnimationProps {\n /**\n * Animation progress shared value (0=idle, 1=open, 2=close)\n */\n progress: SharedValue;\n /**\n * Dragging state shared value\n */\n isDragging: SharedValue;\n}\n\n/**\n * Animation hook for popup bottom sheet content components (Popover, Select bottom sheet presentation)\n * Handles synchronization between BottomSheet animatedIndex and popup progress state\n */\nexport function usePopupBottomSheetContentAnimation({\n progress,\n isDragging,\n}: UsePopupBottomSheetContentAnimationProps) {\n const animatedIndex = useSharedValue(-1);\n const isPanActivated = useSharedValue(false);\n const isClosingOnSwipe = useSharedValue(false);\n\n useAnimatedReaction(\n () => isDragging.get(),\n (current, previous) => {\n if (current && !previous) {\n isClosingOnSwipe.set(false);\n }\n if (!isPanActivated.get() && current) {\n isPanActivated.set(true);\n }\n },\n );\n\n useAnimatedReaction(\n () => animatedIndex.get(),\n (current) => {\n if (!isPanActivated.get()) {\n progress.set(interpolate(current, [-1, 0], [0, 1], Extrapolation.CLAMP));\n } else {\n progress.set(interpolate(current, [0, -1], [1, 2], Extrapolation.CLAMP));\n }\n },\n );\n\n return {\n animatedIndex,\n isPanActivated,\n isClosingOnSwipe,\n };\n}\n", "type": "registry:hook", "target": "@components/pitsi-ui/native-ui/src/helpers/internal/hooks/use-popup-bottom-sheet-content-animation.ts" } ], "categories": [ "native", "react-native", "internal-hooks" ], "meta": { "package": "@pitsi-ui/native", "packageSlug": "native-ui", "platform": "native" } }