A personal agent with a browser, terminal, files, and work that keeps going built with CopilotKit and AG-UI.
TypeScript
fix(mobile): prevent soft keyboard from obscuring chat input on Android (#142)
Madiraju Meher Sai Preetam010d3a0c3ffb
diff --git a/apps/mobile/src/chat.tsx b/apps/mobile/src/chat.tsxindex 29121a2..599364e 100644--- a/apps/mobile/src/chat.tsx+++ b/apps/mobile/src/chat.tsx@@ -10,6 +10,7 @@ import {import { ArrowDown, ArrowUp, FileText, RotateCcw, Square, X } from "lucide-react-native";import { useCallback, useEffect, useRef, useState, useSyncExternalStore } from "react";import {+ Keyboard,KeyboardAvoidingView,Platform,Pressable,@@ -237,6 +238,22 @@ export function ChatScreen({const [historyAttempt, setHistoryAttempt] = useState(0);// Loads still replaying history. A count, so an old load finishing does not end a newer one.const replaying = useRef(0);+ const [keyboardPadding, setKeyboardPadding] = useState(0);++ useEffect(() => {+ if (Platform.OS !== "android") return;+ const onShow = (e: { endCoordinates: { height: number } }) => {+ const bottomNavHeight = 74;+ setKeyboardPadding(Math.max(0, e.endCoordinates.height - bottomNavHeight));+ };+ const onHide = () => setKeyboardPadding(0);+ const showSub = Keyboard.addListener("keyboardDidShow", onShow);+ const hideSub = Keyboard.addListener("keyboardDidHide", onHide);+ return () => {+ showSub.remove();+ hideSub.remove();+ };+ }, []);useEffect(() => {if (!isReady) return;let active = true;@@ -710,7 +727,10 @@ export function ChatScreen({Latest messages</Button>)}- <KeyboardAvoidingView behavior={Platform.OS === "ios" ? "padding" : undefined}>+ <KeyboardAvoidingView+ behavior={Platform.OS === "ios" ? "padding" : undefined}+ style={keyboardPadding > 0 ? { paddingBottom: keyboardPadding } : undefined}+ ><ErrorNotice error={saveError} />{!!saveError && (<Button