Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/05xxx/module_5014.js (118.4 MB)
45 lines
1.4 KiB
TypeScript
45 lines
1.4 KiB
TypeScript
// Module ID: 15420
|
|
// Function ID: 15421
|
|
// Name: useIsCarouselInView
|
|
// Dependencies: [32, 19, 1478, 2]
|
|
// Exports: default
|
|
|
|
// Module 15420 (useIsCarouselInView)
|
|
import useWindowDimensionsDefault from "useWindowDimensions" /* 1478 */;
|
|
import _slicedToArray from "module_32" /* 32 */;
|
|
import noop from "module_19" /* 19 */;
|
|
|
|
const size = fn(2);
|
|
const result = size.fileFinishedImporting("modules/quests/native/useIsCarouselInView.tsx");
|
|
|
|
export default function useIsCarouselInView() {
|
|
const containerRef = noop.useRef(null);
|
|
const height = useWindowDimensionsDefault().height;
|
|
closure_2 = noop.useRef(height);
|
|
const items = [height];
|
|
const effect = noop.useEffect(() => {
|
|
closure_2.current = height;
|
|
}, items);
|
|
[tmp4, noop] = noop.useState(true);
|
|
closure_4 = noop.useRef(isInView);
|
|
const effect1 = noop.useEffect(() => {
|
|
setInterval(() => {
|
|
if (null != ref.current) {
|
|
const current = ref.current;
|
|
current.measure((arg0, arg1, arg2, arg3, arg4, arg5) => {
|
|
const bound = Math.min(arg5 + arg3, ref.current);
|
|
let tmp2 = arg3 > 0;
|
|
if (tmp2) {
|
|
tmp2 = Math.max(0, bound - Math.max(arg5, 0)) / arg3 >= 0.5;
|
|
}
|
|
if (tmp2 !== ref2.current) {
|
|
ref2.current = tmp2;
|
|
closure_1_3(tmp2);
|
|
}
|
|
});
|
|
}
|
|
}, 1000);
|
|
return () => clearInterval(closure_0);
|
|
}, []);
|
|
return { containerRef, isInView };
|
|
};
|