refactor(keyboard): remove unused keyboard watchdog functionality
This commit is contained in:
@@ -34,7 +34,6 @@ import {
|
||||
isKeyboardTargetActive,
|
||||
} from "./keyboard-target";
|
||||
import { addKeyboardRecheckListeners } from "./keyboard-event-listeners";
|
||||
import { createKeyboardWatchdog } from "./keyboard-watchdog";
|
||||
import { isPossibleKeyboardCloseEvent } from "./release-events";
|
||||
import type { UseKeyboardHeightOptions, ViewportMetrics } from "./types";
|
||||
import {
|
||||
@@ -181,7 +180,6 @@ export function useKeyboardHeight({
|
||||
metrics: formatMetrics(metrics),
|
||||
});
|
||||
}
|
||||
watchdog.update("apply");
|
||||
};
|
||||
|
||||
const schedule = () => {
|
||||
@@ -234,24 +232,8 @@ export function useKeyboardHeight({
|
||||
environment,
|
||||
metrics: formatMetrics(metrics),
|
||||
});
|
||||
watchdog.stop(reason);
|
||||
};
|
||||
|
||||
const watchdog = createKeyboardWatchdog({
|
||||
environment,
|
||||
log,
|
||||
getTarget: () => targetRef?.current,
|
||||
getReactActive: () => activeRef.current,
|
||||
getFallbackAllowed: () => fallbackAllowedRef.current,
|
||||
getFallbackWasApplied: () => fallbackWasApplied,
|
||||
getLastInputLift: () => lastInputLift,
|
||||
getFocusedAt: () => focusedAtRef.current,
|
||||
onPossibleClose: () => {
|
||||
lastEventType = "watchdog";
|
||||
lastMayBeKeyboardClose = true;
|
||||
},
|
||||
schedule,
|
||||
});
|
||||
const removeKeyboardRecheckListeners =
|
||||
addKeyboardRecheckListeners(scheduleRechecks);
|
||||
|
||||
@@ -259,7 +241,6 @@ export function useKeyboardHeight({
|
||||
|
||||
return () => {
|
||||
if (rafId != null) window.cancelAnimationFrame(rafId);
|
||||
watchdog.cleanup();
|
||||
timeoutIds.forEach((id) => window.clearTimeout(id));
|
||||
removeKeyboardRecheckListeners();
|
||||
resetKeyboardVars();
|
||||
|
||||
Reference in New Issue
Block a user