decord/source/5709_useKeyboardManager.js

84 lines
2.2 KiB
JavaScript
Raw Normal View History

2026-08-05 07:35:12 +00:00
// Module ID: 5709
// Function ID: 5710
2026-07-20 16:05:17 +00:00
// Name: useKeyboardManager
2026-07-29 08:29:29 +00:00
// Dependencies: [19, 17]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-08-05 07:35:12 +00:00
// Module 5709 (useKeyboardManager)
2026-07-29 08:29:29 +00:00
import noop from "noop";
2026-07-23 10:11:24 +00:00
import get_ActivityIndicator from "get ActivityIndicator";
let closure_1;
2026-07-29 08:29:29 +00:00
let obj1;
({ Keyboard: closure_1, TextInput: obj1 } = get_ActivityIndicator);
2026-07-20 16:05:17 +00:00
export default function useKeyboardManager(arg0) {
const React = arg0;
let closure_1 = React.useRef(undefined);
let closure_2 = React.useRef(0);
let closure_3 = React.useRef();
const callback = React.useCallback(() => {
if (undefined !== ref3.current) {
const _clearTimeout = clearTimeout;
2026-07-29 08:29:29 +00:00
clearTimeout(tmp.current);
tmp.current = undefined;
2026-07-20 16:05:17 +00:00
}
}, []);
const items = [callback, arg0];
const items1 = [callback, arg0];
const onPageChangeStart = React.useCallback(() => {
2026-07-23 10:11:24 +00:00
if (callback()) {
2026-07-20 16:05:17 +00:00
callback();
const State = ref2.State;
const result = State.currentlyFocusedInput();
2026-07-29 08:29:29 +00:00
if (result != null) {
2026-07-20 16:05:17 +00:00
result.blur();
}
closure_1.current = result;
const _Date = Date;
ref2.current = Date.now();
}
}, items);
const items2 = [callback, arg0];
const onPageChangeConfirm = React.useCallback((arg0) => {
2026-07-23 10:11:24 +00:00
if (callback()) {
2026-07-20 16:05:17 +00:00
callback();
if (arg0) {
ref.dismiss();
} else {
const current = ref.current;
2026-07-29 08:29:29 +00:00
if (current != null) {
2026-07-20 16:05:17 +00:00
current.blur();
}
}
ref.current = undefined;
}
}, items1);
const items3 = [callback];
const onPageChangeCancel = React.useCallback(() => {
2026-07-23 10:11:24 +00:00
if (current()) {
2026-07-20 16:05:17 +00:00
callback();
2026-07-23 10:11:24 +00:00
current = ref.current;
2026-07-20 16:05:17 +00:00
if (current) {
const _Date = Date;
if (Date.now() - ref2.current < 100) {
const _setTimeout = setTimeout;
closure_3.current = setTimeout(() => {
2026-07-29 08:29:29 +00:00
if (current != null) {
2026-07-20 16:05:17 +00:00
current.focus();
}
2026-07-23 10:11:24 +00:00
outer1_1.current = undefined;
2026-07-20 16:05:17 +00:00
}, 100);
} else {
2026-07-29 08:29:29 +00:00
if (current != null) {
2026-07-20 16:05:17 +00:00
current.focus();
}
2026-07-29 08:29:29 +00:00
tmp3.current = undefined;
2026-07-20 16:05:17 +00:00
}
}
}
}, items2);
2026-07-29 08:29:29 +00:00
const effect = React.useEffect(() => () => callback(), items3);
2026-07-20 16:05:17 +00:00
return { onPageChangeStart, onPageChangeConfirm, onPageChangeCancel };
};