decord/source/modules/media_viewer/native/useMediaViewerClosePosition.tsx
2026-07-24 07:16:23 +00:00

68 lines
2.3 KiB
TypeScript

// Module ID: 12283
// Function ID: 95939
// Name: computeClosePosition
// Dependencies: [57, 31, 653, 12280, 8435, 3991, 2]
// Exports: default
// Module 12283 (computeClosePosition)
import _slicedToArray from "_slicedToArray";
import result from "result";
import { NOOP } from "ME";
const require = arg1;
function computeClosePosition(arg0, height) {
if (null != arg2) {
let obj = importDefault(12280)(arg0, height, arg2);
} else {
obj = { height };
}
return (height + obj.height) / 2;
}
let closure_6 = { code: "function useMediaViewerClosePositionTsx1(){const{index}=this.__closure;return index.get();}" };
let closure_7 = { code: "function useMediaViewerClosePositionTsx2(index){const{runOnJS,setClosePosition}=this.__closure;runOnJS(setClosePosition)(index);}" };
const result = require("ME").fileFinishedImporting("modules/media_viewer/native/useMediaViewerClosePosition.tsx");
export default function useMediaViewerClosePosition(index) {
index = index.index;
const sources = index.sources;
let onClose = index.onClose;
if (onClose === undefined) {
onClose = closure_5;
}
const windowHeight = index.windowHeight;
const windowWidth = index.windowWidth;
let React;
closure_5 = undefined;
let callback;
const tmp = sources(windowHeight[4])(onClose);
React = tmp;
const tmp2 = windowWidth(React.useState(() => outer1_8(windowWidth, windowHeight, sources[index.get(index)])), 2);
closure_5 = tmp2[1];
const items = [tmp, sources, windowHeight, windowWidth];
callback = React.useCallback((arg0) => {
if (null == sources[arg0]) {
_undefined();
}
callback(outer1_8(windowWidth, windowHeight, sources[arg0]));
}, items);
let obj = index(windowHeight[5]);
const fn = function h() {
return index.get();
};
fn.__closure = { index };
fn.__workletHash = 5031282724746;
fn.__initData = callback;
const fn2 = function f(arg0) {
index(windowHeight[5]).runOnJS(callback)(arg0);
};
obj = { runOnJS: index(windowHeight[5]).runOnJS, setClosePosition: callback };
fn2.__closure = obj;
fn2.__workletHash = 2709880768438;
fn2.__initData = closure_7;
const animatedReaction = obj.useAnimatedReaction(fn, fn2);
const items1 = [callback, index];
const effect = React.useEffect(() => {
callback(index.get());
}, items1);
return tmp2[0];
};