decord/source/modules/collectibles/native/VisibilitySensor.tsx

80 lines
2.3 KiB
TypeScript
Raw Normal View History

// Module ID: 15949
// Function ID: 15950
// Name: VisibilitySensor
// Dependencies: [19, 17, 21, 1478, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
// Module 15949 (VisibilitySensor)
import _mod17 from "module_17" /* 17 */;
import useWindowDimensionsDefault from "useWindowDimensions" /* 1478 */;
import noop_mod from "module_19" /* 19 */;
2026-08-24 06:08:38 +00:00
import jsxProd from "jsxProd" /* 21 */;
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
let noop = noop_mod;
({ useEffect: c2, useRef: c3 } = noop);
let noop = noop_mod;
const View = _mod17.View;
({ jsx: metroRequire, jsxs: closure_7 } = jsxProd);
const result = size.fileFinishedImporting("modules/collectibles/native/VisibilitySensor.tsx");
2026-07-20 16:05:17 +00:00
export default function _default(onChange) {
onChange = onChange.onChange;
function stopWatching() {
2026-07-20 16:05:17 +00:00
if (null !== ref.current) {
const _clearInterval = clearInterval;
2026-07-29 08:29:29 +00:00
clearInterval(tmp.current);
tmp.current = null;
2026-07-20 16:05:17 +00:00
}
}
({ children, resetKey } = onChange);
let tmp = React3(null);
closure_1 = tmp;
closure_2 = React3(false);
const size = useWindowDimensionsDefault();
const width = size.width;
const height = size.height;
React3(null);
2026-07-20 16:05:17 +00:00
const items = [resetKey];
React2(() => {
2026-07-20 16:05:17 +00:00
closure_2.current = false;
}, items);
const items1 = [onChange];
const callback = noop.useCallback((arg0, arg1) => {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
if (null === arg1.current) {
2026-07-20 16:05:17 +00:00
const _setInterval = setInterval;
2026-07-29 08:29:29 +00:00
tmp.current = setInterval(() => {
2026-07-23 10:11:24 +00:00
if (null !== ref.current) {
const current = ref.current;
2026-07-20 16:05:17 +00:00
current.measure((arg0, arg1, arg2, arg3, arg4, arg5) => {
let tmp = arg5 + arg3 > 0;
if (tmp) {
tmp = arg5 < ref;
2026-07-20 16:05:17 +00:00
}
if (tmp) {
tmp = arg4 < closure_1_0;
2026-07-20 16:05:17 +00:00
}
if (tmp) {
tmp = arg4 + arg2 > 0;
}
if (tmp !== ref2.current) {
ref2.current = tmp;
closure_0(tmp);
2026-07-20 16:05:17 +00:00
}
});
}
}, 1000);
}
}, items1);
const items2 = [callback, height, width];
React2(() => {
2026-07-20 16:05:17 +00:00
callback(width, height);
return stopWatching;
}, items2);
2026-07-29 08:29:29 +00:00
const obj = { collapsable: false, ref: tmp, children: null };
const items3 = [children, timestampProducer(View, {})];
obj.children = items3;
return React5(View, obj);
2026-07-20 16:05:17 +00:00
};