Hide terminal keyboard when opening sidebars

This commit is contained in:
Mohamed Boudra
2026-05-25 19:26:38 +07:00
parent 2252046f56
commit 5dd2afaac9
6 changed files with 34 additions and 2 deletions
@@ -8,7 +8,7 @@ import {
type ComponentProps,
type Ref,
} from "react";
import { StyleSheet, View, type StyleProp, type ViewStyle } from "react-native";
import { Keyboard, StyleSheet, View, type StyleProp, type ViewStyle } from "react-native";
import { WebView, type WebViewMessageEvent } from "react-native-webview";
import type { ITheme } from "@xterm/xterm";
import type { TerminalState } from "@server/shared/messages";
@@ -28,6 +28,7 @@ export interface TerminalEmulatorHandle {
restoreOutput: (data: TerminalOutputData) => void;
renderSnapshot: (state: TerminalState | null) => void;
clear: () => void;
blur: () => void;
}
interface TerminalEmulatorProps {
@@ -334,6 +335,12 @@ export default function TerminalEmulator({
outputDecoderRef.current.decode();
sendToWebView({ type: "clear", streamKey });
},
blur: () => {
webViewRef.current?.injectJavaScript(
"window.__PASEO_TERMINAL_WEBVIEW_BLUR__ && window.__PASEO_TERMINAL_WEBVIEW_BLUR__(); true;",
);
Keyboard.dismiss();
},
}),
[sendToWebView, streamKey],
);