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

46 lines
1.4 KiB
TypeScript
Raw Normal View History

2026-07-27 11:26:19 +00:00
// Module ID: 14041
// Function ID: 107461
2026-07-20 16:05:17 +00:00
// Name: useIsCarouselInView
2026-07-23 10:11:24 +00:00
// Dependencies: [57, 31, 1450, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-07-27 11:26:19 +00:00
// Module 14041 (useIsCarouselInView)
2026-07-23 10:11:24 +00:00
import _slicedToArray from "_slicedToArray";
import result from "result";
const result = require("useWindowDimensions").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-07-23 10:11:24 +00:00
_slicedToArray.current = height;
2026-07-20 16:05:17 +00:00
}, items);
const tmp3 = callback(React.useState(true), 2);
const isInView = tmp3[0];
2026-07-23 10:11:24 +00:00
React = tmp3[1];
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-23 10:11:24 +00:00
const bound = Math.min(arg5 + arg3, outer2_2.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-23 10:11:24 +00:00
if (tmp2 !== outer2_4.current) {
outer2_4.current = tmp2;
outer2_3(tmp2);
2026-07-20 16:05:17 +00:00
}
});
}
}, 1000);
return () => clearInterval(closure_0);
}, []);
return { containerRef, isInView };
};