Files
discord-decomp/modules/video_calls/native/components/GestureContainer.tsx
T
2026-11-01 12:12:55 +02:00

91 lines
4.0 KiB
TypeScript

// Metro module 10815 (f10816).
import { View } from "react-native";
import { useChannelCallStore } from "../ChannelCallStore";
import { PAN_GESTURE_FAIL_OFFSET_Y, SWIPE_TO_CHAT_ACTIVE_OFFSET } from "./Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import useWindowDimensions_native from "../../../screen/useWindowDimensions.native";
import * as _ReanimatedRexport from "../../../reanimated/ReanimatedRexport";
import ReanimatedRexport, { useSharedValue, useAnimatedStyle } from "../../../reanimated/ReanimatedRexport";
import { Gesture, GestureDetector } from "../../../../_bundle/Module5273";
import ModalActionCreators from "../../../../actions/ModalActionCreators";
import * as _timing from "../../../../design/animation/reanimated/timing/timing";
import * as _native from "../../../../design/void/native";
const useStyles = createStyles({
background: {
flex: 1,
backgroundColor: Module712.colors.BLACK
}
});
const __initData = {
code: "function GestureContainerTsx1({velocityY:velocityY}){const{position,THRESHOLD_VELOCITY,runOnJS,ModalActionCreators,withTiming,DECELERATED_EASING}=this.__closure;if(position.get()===1||velocityY>THRESHOLD_VELOCITY){runOnJS(ModalActionCreators.pop)();}else{position.set(withTiming(0,{duration:300,easing:DECELERATED_EASING}));}}"
};
const __initData2 = {
code: "function GestureContainerTsx2({translationY:translationY}){const{THRESHOLD_TRANSLATE,position}=this.__closure;const boundedGestureY=Math.max(Math.min(translationY,THRESHOLD_TRANSLATE),0)/THRESHOLD_TRANSLATE;const easeOutCubic=1-Math.pow(1-boundedGestureY,3);position.set(easeOutCubic);}"
};
const __initData3 = {
code: "function GestureContainerTsx3(){const{interpolate,position,height}=this.__closure;return{flex:1,transform:[{translateY:interpolate(position.get(),[0,1],[0,height*0.06])},{scale:interpolate(position.get(),[0,1],[1,0.9])}]};}"
};
export default function GestureContainer(props) {
let height, sharedValue;
const children = props.children;
height = void 0;
sharedValue = void 0;
const styles = useStyles();
const channelCallStore = useChannelCallStore((a0) => a0.isGestureEnabled);
height = useWindowDimensions_native().height;
sharedValue = useSharedValue(0);
const r30 = Gesture.Pan().enabled(channelCallStore);
const S = function S(a0) {
sharedValue.set(1 - Math.pow(1 - Math.max(Math.min(a0.translationY, 200), 0) / 200, 3));
};
S.__closure = {
THRESHOLD_TRANSLATE: 200,
position: sharedValue
};
S.__workletHash = 9476726087456;
S.__initData = __initData2;
const r35 = r30.onUpdate(S);
const h = function h({ velocityY }) {
if (sharedValue.get() !== 1 && !(velocityY > 500)) {
sharedValue.set(_timing.withTiming(0, {
duration: 300,
easing: _native.DECELERATED_EASING
}));
} else {
_ReanimatedRexport.runOnJS(ModalActionCreators.pop)();
}
};
h.__closure = {
position: sharedValue,
THRESHOLD_VELOCITY: 500,
runOnJS: _ReanimatedRexport.runOnJS,
ModalActionCreators,
withTiming: _timing.withTiming,
DECELERATED_EASING: _native.DECELERATED_EASING
};
h.__workletHash = 10736744030668;
h.__initData = __initData;
const gesture = r35.onEnd(h).activeOffsetY([-PAN_GESTURE_FAIL_OFFSET_Y, PAN_GESTURE_FAIL_OFFSET_Y]).failOffsetX([-SWIPE_TO_CHAT_ACTIVE_OFFSET, SWIPE_TO_CHAT_ACTIVE_OFFSET]);
const r65 = () => ({
flex: 1,
transform: [{
translateY: _ReanimatedRexport.interpolate(sharedValue.get(), [0, 1], [0, 0.06 * height])
}, {
scale: _ReanimatedRexport.interpolate(sharedValue.get(), [0, 1], [1, 0.9])
}]
});
r65.__closure = {
interpolate: _ReanimatedRexport.interpolate,
position: sharedValue,
height
};
r65.__workletHash = 16049033434372;
r65.__initData = __initData3;
return <View style={styles.background}>
<GestureDetector gesture={gesture}>
<ReanimatedRexport.View style={useAnimatedStyle(r65)}>{children}</ReanimatedRexport.View>
</GestureDetector>
</View>;
};