Skip to content

Commit e37e2a8

Browse files
lmanchuclaude
andcommitted
fix: auto-scroll to latest message when entering chat
Add .onAppear to ScrollViewReader so the chat view scrolls to the bottom immediately when opened, not just when new messages arrive. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent d9d99da commit e37e2a8

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

ios/Sigil/Sources/Views/ChatView.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ struct ChatView: View {
3434
#if os(iOS)
3535
.scrollDismissesKeyboard(.interactively)
3636
#endif
37+
.onAppear {
38+
if let lastId = messages.last?.messageId {
39+
proxy.scrollTo(lastId, anchor: .bottom)
40+
}
41+
}
3742
.onChange(of: messages.count) { _, _ in
3843
if let lastId = messages.last?.messageId {
3944
withAnimation(.easeOut(duration: 0.2)) {

0 commit comments

Comments
 (0)