From 502f6f1cdefc2595279dc9481a1068eebbcbbba7 Mon Sep 17 00:00:00 2001 From: fmodf Date: Mon, 1 Jul 2024 12:04:19 +0200 Subject: [PATCH] wip --- .../Conversation/ConversationScreen.swift | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/ConversationsClassic/View/Screens/Conversation/ConversationScreen.swift b/ConversationsClassic/View/Screens/Conversation/ConversationScreen.swift index 55f89ad..b691d13 100644 --- a/ConversationsClassic/View/Screens/Conversation/ConversationScreen.swift +++ b/ConversationsClassic/View/Screens/Conversation/ConversationScreen.swift @@ -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) + } + } } } }