Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

fix(ios): stabilize chat scrolling and dismiss keyboard

leepokai22d91068966d
diff --git a/kit/Sources/CodyncUI/Thread/ThreadView.swift b/kit/Sources/CodyncUI/Thread/ThreadView.swift
index bca9cfef..3832859b 100644
--- a/kit/Sources/CodyncUI/Thread/ThreadView.swift
+++ b/kit/Sources/CodyncUI/Thread/ThreadView.swift
@@ -1,5 +1,8 @@
import CodyncKit
import SwiftUI
+#if os(iOS)
+ import UIKit
+#endif
/// One endless conversation with a bot or a group chat. Only deliberate messages show
/// here; tool calls and thinking live in the "Full conversation" sheet. Any message can
@@ -119,11 +122,14 @@ public struct ThreadView: View {
.defaultScrollAnchor(.bottom)
.scrollDismissesKeyboard(.interactively)
.conversationScrollEdges()
+ #if os(iOS)
+ .simultaneousGesture(TapGesture().onEnded { dismissChatKeyboard() })
+ #endif
.onChange(of: items.last?.id) { _, _ in
- withAnimation(.snappy) { proxy.scrollTo("bottom", anchor: .bottom) }
+ proxy.scrollTo("bottom", anchor: .bottom)
}
.onChange(of: bot?.isWorking) { _, _ in
- withAnimation(.snappy) { proxy.scrollTo("bottom", anchor: .bottom) }
+ proxy.scrollTo("bottom", anchor: .bottom)
}
}
.background(Palette.background)
@@ -222,6 +228,12 @@ public struct ThreadView: View {
.deleteBotConfirmation($confirmDelete) { dismiss() }
}
+ #if os(iOS)
+ private func dismissChatKeyboard() {
+ UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil)
+ }
+ #endif
+
// MARK: rows
@ViewBuilder private func row(_ item: ChatItem) -> some View {