fix(chat): improve in-app keyboard avoidance

This commit is contained in:
2026-06-24 15:13:11 +08:00
parent 853ae776f9
commit 08c954903f
7 changed files with 193 additions and 66 deletions
@@ -3,6 +3,7 @@ import { useRef, useState } from "react";
import { useChatDispatch } from "@/stores/chat/chat-context";
import { useUserState } from "@/stores/user/user-context";
import { useKeyboardHeight } from "@/hooks";
import { Logger } from "@/utils";
import { ChatInputActionPanel } from "./chat-input-action-panel";
@@ -28,6 +29,11 @@ export function ChatInputBar({ disabled = false }: ChatInputBarProps) {
const isActive = isFocused || isActionPanelOpen;
const voiceMinutesRemaining = currentUser?.voiceMinutesRemaining ?? 0;
useKeyboardHeight({
targetRef: textareaRef,
active: isFocused,
});
const handleInputChange = (value: string) => {
setInput(value);
if (value.trim().length > 0) {