This commit is contained in:
fmodf 2024-07-01 12:04:19 +02:00
parent c3bd783769
commit 502f6f1cde

View file

@ -45,8 +45,10 @@ struct ConversationScreen: View {
.scrollIndicators(.hidden) .scrollIndicators(.hidden)
.onChange(of: messages) { _ in .onChange(of: messages) { _ in
if autoScroll { if autoScroll {
withAnimation { DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
proxy.scrollTo(messages.last?.id, anchor: .bottom) withAnimation {
proxy.scrollTo(messages.last?.id, anchor: .bottom)
}
} }
} }
} }
@ -71,10 +73,25 @@ struct ConversationScreen: View {
// Jump to last button // Jump to last button
if !autoScroll { if !autoScroll {
Button { VStack {
autoScroll = true Spacer()
} label: { HStack {
Text("TEST") Spacer()
Button {
autoScroll = true
} label: {
ZStack {
Circle()
.fill(Color.Main.white)
Image(systemName: "arrow.down")
.foregroundColor(.Tango.blueLight)
}
.frame(width: 40, height: 40)
.shadow(color: .Main.black.opacity(0.2), radius: 4)
.padding(.trailing, 8)
.padding(.bottom, 8)
}
}
} }
} }
} }