Scroll to bottom of the lazyVStack when the keyboard opens / input field gains focus in dm and buffer views
This commit is contained in:
parent
6c404ba7fd
commit
71468f02f2
2 changed files with 10 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue