// Metro module 10878 (f10879). import * as _ReanimatedRexport from "../../../reanimated/ReanimatedRexport"; import { useSharedValue } from "../../../reanimated/ReanimatedRexport"; import { Gesture } from "../../../../_bundle/Module5273"; import * as _spring from "../../../../design/animation/reanimated/spring/spring"; import ModalActionCreators from "../../../../actions/ModalActionCreators"; const __initData = { code: "function useModalPanGestureTsx1({velocityY:velocityY}){const{translateY,thresholdTranslate,thresholdVelocity,withSpring,height,runOnJS,ModalActionCreators,onClose,onEnd}=this.__closure;const config={damping:15,mass:1,stiffness:250,overshootClamping:true,restSpeedThreshold:0.001,restDisplacementThreshold:0.001,velocity:velocityY};if(translateY.get()>=thresholdTranslate||velocityY>=thresholdVelocity){translateY.set(withSpring(height,config,'respect-motion-settings',function(){runOnJS(ModalActionCreators.pop)();}));if(onClose!=null){runOnJS(onClose)();}}else{translateY.set(withSpring(0,config));}if(onEnd!=null){runOnJS(onEnd)();}}" }; const __initData2 = { code: "function useModalPanGestureTsx2({translationY:translationY}){const{translateY,interpolate,start,maxTranslate,Extrapolate}=this.__closure;translateY.set(interpolate(start.get().y+translationY,[0,maxTranslate],[0,maxTranslate],Extrapolate.CLAMP));}" }; const __initData3 = { code: "function useModalPanGestureTsx3(){const{onStart,runOnJS,start,translateY}=this.__closure;if(onStart!=null){runOnJS(onStart)();}start.set({y:translateY.get()});}" }; const __initData4 = { code: "function useModalPanGestureTsx4(){const{runOnJS,ModalActionCreators}=this.__closure;runOnJS(ModalActionCreators.pop)();}" }; export default function useModalPanGesture(a0) { let thresholdVelocity = a0.thresholdVelocity; if (thresholdVelocity === void 0) { thresholdVelocity = 500; } let c18335_0 = thresholdVelocity; const { gestureEnabled, maxTranslate, thresholdTranslate, height, translateY, onStart, onEnd, onClose } = a0; const sharedValue = useSharedValue({ y: 0 }); const r27 = Gesture.Pan().enabled(gestureEnabled); const J = function J() { if (onStart != null) { _ReanimatedRexport.runOnJS(onStart)(); } sharedValue.set({ y: translateY.get() }); }; J.__closure = { onStart, runOnJS: _ReanimatedRexport.runOnJS, start: sharedValue, translateY }; J.__workletHash = 15847989720945; J.__initData = __initData3; const r35 = r27.onStart(J); const x = function x({ translationY }) { translateY.set(_ReanimatedRexport.interpolate(sharedValue.get().y + translationY, [0, maxTranslate], [0, maxTranslate], _ReanimatedRexport.Extrapolate.CLAMP)); }; x.__closure = { translateY, interpolate: _ReanimatedRexport.interpolate, start: sharedValue, maxTranslate, Extrapolate: _ReanimatedRexport.Extrapolate }; x.__workletHash = 6809176231356; x.__initData = __initData2; const r47 = r35.onUpdate(x); const O = function O({ velocityY }) { const r12 = { damping: 15, mass: 1, stiffness: 250, overshootClamping: true, restSpeedThreshold: 0.001, restDisplacementThreshold: 0.001, velocity: velocityY }; if (!(translateY.get() >= thresholdTranslate) && !(velocityY >= c18335_0)) { translateY.set(_spring.withSpring(0, r12)); } else { const n = function n() { _ReanimatedRexport.runOnJS(ModalActionCreators.pop)(); }; n.__closure = { runOnJS: _ReanimatedRexport.runOnJS, ModalActionCreators }; n.__workletHash = 14223008059411; n.__initData = __initData4; translateY.set(_spring.withSpring(height, r12, "respect-motion-settings", n)); if (onClose != null) { _ReanimatedRexport.runOnJS(onClose)(); } } if (onEnd != null) { _ReanimatedRexport.runOnJS(onEnd)(); } }; O.__closure = { translateY, thresholdTranslate, thresholdVelocity, withSpring: _spring.withSpring, height, runOnJS: _ReanimatedRexport.runOnJS, ModalActionCreators, onClose, onEnd }; O.__workletHash = 16881029664873; O.__initData = __initData; return r47.onEnd(O).failOffsetY(-0.01).activeOffsetY([-5, 15]); };