1import { useSyncExternalStore } from "react";
2
3import { isElectron } from "../env";
4import { createSoftwareKeyboardStore } from "../lib/softwareKeyboard";
5
6const store = createSoftwareKeyboardStore(
7 typeof window === "undefined" ? undefined : window,
8 isElectron,
9);
10
11function getServerSnapshot() {
12 return false;
13}
14
15export function useSoftwareKeyboardOpen() {
16 return useSyncExternalStore(store.subscribe, store.getSnapshot, getServerSnapshot);
17}