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

44 lines
1.4 KiB
TypeScript
Raw Normal View History

// Module ID: 15003
// Function ID: 15004
2026-07-20 16:05:17 +00:00
// Name: useIsCarouselInView
2026-09-02 09:53:35 +00:00
// Dependencies: [32, 19, 1492, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
// Module 15003 (useIsCarouselInView)
2026-08-24 06:08:38 +00:00
import closure_2 from "_slicedToArray" /* 32 */;
import closure_3 from "noop" /* 19 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("modules/quests/native/useIsCarouselInView.tsx");
2026-07-20 16:05:17 +00:00
export default function useIsCarouselInView() {
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-08-24 06:08:38 +00:00
closure_2.current = height;
2026-07-20 16:05:17 +00:00
}, items);
2026-08-24 06:08:38 +00:00
[tmp4, closure_3] = callback(React.useState(true), 2);
closure_4 = React.useRef(isInView);
2026-07-20 16:05:17 +00:00
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 };
};