decord/source/modules/quests/native/useIsCarouselInView.tsx

46 lines
1.4 KiB
TypeScript
Raw Normal View History

2026-08-15 05:55:55 +00:00
// Module ID: 14432
// Function ID: 14433
2026-07-20 16:05:17 +00:00
// Name: useIsCarouselInView
2026-08-15 05:55:55 +00:00
// Dependencies: [32, 19, 1494, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-08-15 05:55:55 +00:00
// Module 14432 (useIsCarouselInView)
2026-07-23 10:11:24 +00:00
import _slicedToArray from "_slicedToArray";
2026-07-29 08:29:29 +00:00
import noop from "noop";
2026-07-23 10:11:24 +00:00
const result = require("useWindowDimensions").fileFinishedImporting("modules/quests/native/useIsCarouselInView.tsx");
2026-07-20 16:05:17 +00:00
export default function useIsCarouselInView() {
2026-07-29 08:29:29 +00:00
let noop;
let tmp4;
2026-07-20 16:05:17 +00:00
const containerRef = React.useRef(null);
2026-07-23 10:11:24 +00:00
height = containerRef(height[2])().height;
2026-07-20 16:05:17 +00:00
const callback = React.useRef(height);
const items = [height];
const effect = React.useEffect(() => {
2026-07-23 10:11:24 +00:00
_slicedToArray.current = height;
2026-07-20 16:05:17 +00:00
}, items);
2026-07-29 08:29:29 +00:00
[tmp4, noop] = callback(React.useState(true), 2);
2026-07-20 16:05:17 +00:00
let closure_4 = React.useRef(isInView);
const effect1 = React.useEffect(() => {
const interval = setInterval(() => {
if (null != ref.current) {
const current = ref.current;
current.measure((arg0, arg1, arg2, arg3, arg4, arg5) => {
2026-07-29 08:29:29 +00:00
const bound = Math.min(arg5 + arg3, ref.current);
2026-07-20 16:05:17 +00:00
let tmp2 = arg3 > 0;
if (tmp2) {
tmp2 = Math.max(0, bound - Math.max(arg5, 0)) / arg3 >= 0.5;
}
2026-07-29 08:29:29 +00:00
if (tmp2 !== ref2.current) {
ref2.current = tmp2;
callback(tmp2);
2026-07-20 16:05:17 +00:00
}
});
}
}, 1000);
return () => clearInterval(closure_0);
}, []);
return { containerRef, isInView };
};