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