52 lines
1.5 KiB
TypeScript
52 lines
1.5 KiB
TypeScript
// Metro module 11919 (f11920).
|
|
import Module19, { useEffect, useRef } from "react";
|
|
import { View } from "react-native";
|
|
import useWindowDimensions_native from "../../screen/useWindowDimensions.native";
|
|
export default ({ children, onChange, resetKey }) => {
|
|
let ref, ref2, width, height, ref3, callback;
|
|
ref = void 0;
|
|
ref2 = void 0;
|
|
width = void 0;
|
|
height = void 0;
|
|
ref3 = void 0;
|
|
callback = void 0;
|
|
const stopWatching2 = function stopWatching() {
|
|
if (ref3.current !== null) {
|
|
clearInterval(ref3.current);
|
|
ref3.current = null;
|
|
}
|
|
};
|
|
ref = useRef(null);
|
|
ref2 = useRef(false);
|
|
const windowDimensions_native = useWindowDimensions_native();
|
|
width = windowDimensions_native.width;
|
|
height = windowDimensions_native.height;
|
|
ref3 = useRef(null);
|
|
useEffect(() => {
|
|
ref2.current = false;
|
|
}, [resetKey]);
|
|
callback = Module19.useCallback((c27209_0, c27209_1) => {
|
|
if (ref3.current === null) {
|
|
ref3.current = setInterval(() => {
|
|
if (ref.current !== null) {
|
|
ref.current.measure((a0, a1, a2, a3, a4, a5) => {
|
|
const current = a5 + a3 > 0 && a5 < c27209_1 && a4 < c27209_0 && a4 + a2 > 0;
|
|
if (current !== ref2.current) {
|
|
ref2.current = current;
|
|
onChange(current);
|
|
}
|
|
});
|
|
}
|
|
}, 1000);
|
|
}
|
|
}, [onChange]);
|
|
useEffect(() => {
|
|
callback(width, height);
|
|
return stopWatching2;
|
|
}, [callback, height, width]);
|
|
return <View collapsable={false} ref={ref}>
|
|
{children}
|
|
<View />
|
|
</View>;
|
|
};
|