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

View file

@ -45,11 +45,13 @@ struct ConversationScreen: View {
.scrollIndicators(.hidden) .scrollIndicators(.hidden)
.onChange(of: messages) { _ in .onChange(of: messages) { _ in
if autoScroll { if autoScroll {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
withAnimation { withAnimation {
proxy.scrollTo(messages.last?.id, anchor: .bottom) proxy.scrollTo(messages.last?.id, anchor: .bottom)
} }
} }
} }
}
.onChange(of: autoScroll) { new in .onChange(of: autoScroll) { new in
if new { if new {
withAnimation { withAnimation {
@ -71,10 +73,25 @@ struct ConversationScreen: View {
// Jump to last button // Jump to last button
if !autoScroll { if !autoScroll {
VStack {
Spacer()
HStack {
Spacer()
Button { Button {
autoScroll = true autoScroll = true
} label: { } label: {
Text("TEST") 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)
}
}
} }
} }
} }