decord/beta/source/modules/keyboard/native/KeyboardAwareView.tsx
2026-10-07 22:43:51 +00:00

118 lines
3.8 KiB
TypeScript

// Module ID: 6537
// Function ID: 6538
// Name: KeyboardAwareView
// Dependencies: [32, 19, 17, 1486, 21, 1884, 4747, 1616, 6474, 6472, 6473, 2]
// Module 6537 (KeyboardAwareView)
import Fragment from "Fragment" /* 21 */;
import useKeyboardDuration from "useKeyboardDuration" /* 6472 */;
import _slicedToArray from "_slicedToArray" /* 32 */;
import react from "react" /* 19 */;
import react_native from "react-native" /* 17 */;
import subscribeToKeyboardUIStore from "subscribeToKeyboardUIStore" /* 1486 */;
import size from "module_2" /* 2 */;
let closure_4;
let hasOwnProperty;
({ View: closure_4, StyleSheet: hasOwnProperty } = react_native);
const jsx = Fragment.jsx;
const memoResult = react.memo(function KeyboardAwareView(style) {
let children;
let pointerEvents;
style = style.style;
let flag = style.animated;
({ children, pointerEvents } = style);
if (flag === undefined) {
flag = true;
}
let num = style.keyboardHeightOffset;
if (num === undefined) {
num = 0;
}
let marginBottom;
let closure_5;
let ref;
let obj = ref;
let tmp = style;
let tmp2 = flag;
const useRef = ref.useRef;
let _Math = Math;
const obj2 = style(flag[5]);
let systemKeyboardHeight = obj2.getSystemKeyboardHeight();
if (0 === systemKeyboardHeight) {
const tmpResult = tmp(tmp2[6]);
let keyboardType = tmpResult.getKeyboardType();
let num2 = 0;
if (keyboardType !== tmp(tmp2[7]).KeyboardTypes.SYSTEM) {
const tmpResult2 = tmp(tmp2[8]);
num2 = tmpResult2.getCustomKeyboardHeight();
}
systemKeyboardHeight = num2;
}
ref = useRef(max(0, systemKeyboardHeight + num));
const tmp6 = num(obj.useState(ref.current), 2);
marginBottom = tmp6[0];
closure_5 = tmp6[1];
const items = [num];
const effect = obj.useEffect(() => subscribeToKeyboardUIStore(() => {
const _Math = Math;
const obj = style(flag[5]);
let systemKeyboardHeight = obj.getSystemKeyboardHeight();
const tmp = closure_1_2;
if (0 === systemKeyboardHeight) {
const tmp2Result = style(flag[6]);
const keyboardType = tmp2Result.getKeyboardType();
num = 0;
if (keyboardType !== style(flag[7]).KeyboardTypes.SYSTEM) {
const tmp2Result2 = style(flag[8]);
num = tmp2Result2.getCustomKeyboardHeight();
}
systemKeyboardHeight = num;
}
const maxResult = max(0, systemKeyboardHeight + tmp);
if (ref.current !== maxResult) {
ref.current = maxResult;
closure_1_5(maxResult);
}
}), items);
ref = obj.useRef(false);
const items1 = [flag, marginBottom];
const effect1 = obj.useEffect(() => {
if (ref.current) {
const obj = useKeyboardDuration;
const keyboardDuration = obj.getKeyboardDuration();
let tmp5 = flag;
const tmp2 = require;
if (tmp5) {
tmp5 = keyboardDuration > 0;
}
if (tmp5) {
const tmp2Result = tmp2(6473);
const result = tmp2Result.DeprecatedLayoutAnimationKeyboard(keyboardDuration);
}
} else {
tmp.current = true;
}
}, items1);
const items2 = [marginBottom, style];
return <marginBottom style={obj.useMemo(() => {
if (null == style) {
return { marginBottom };
} else {
let obj3;
const flattenResult = hasOwnProperty.flatten(tmp);
if (typeof flattenResult.marginBottom === "number") {
const obj = { marginBottom: flattenResult.marginBottom + marginBottom };
const merged = Object.assign(flattenResult);
obj3 = obj;
} else {
obj3 = { marginBottom };
const merged1 = Object.assign(flattenResult);
}
return obj3;
}
}, items2)} pointerEvents={pointerEvents}>{children}</marginBottom>;
});
let result = size.fileFinishedImporting("modules/keyboard/native/KeyboardAwareView.tsx");
export default memoResult;