Scroll to bottom of the lazyVStack when the keyboard opens / input field gains focus in dm and buffer views

This commit is contained in:
Blake Oliver 2026-04-20 17:58:53 -06:00
parent 6c404ba7fd
commit 71468f02f2
No known key found for this signature in database
2 changed files with 10 additions and 0 deletions

View file

@ -38,6 +38,11 @@ struct ChatBufferView: View {
}
.padding()
}
.onChange(of: isInputFocused) { _, focused in
if focused, let last = messages.last {
proxy.scrollTo(last.persistentModelID, anchor: .bottom)
}
}
.onChange(of: messages.count) {
guard let last = messages.last, last.sessionId == manager.sessionId else { return }
Task { @MainActor in

View file

@ -34,6 +34,11 @@ struct DMConversationView: View {
}
.padding()
}
.onChange(of: isInputFocused) { _, focused in
if focused, let last = messages.last {
proxy.scrollTo(last.persistentModelID, anchor: .bottom)
}
}
.onChange(of: messages.count) {
guard let last = messages.last, last.sessionId == manager.sessionId else { return }
Task { @MainActor in