From aa9d9ad2a1a6ee1f118598edc8bd0a9c6541f24e Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin Date: Mon, 1 Jul 2024 00:07:00 +0100 Subject: [PATCH] add animation, remove vstack --- .../Shared/Views/ChatList/ChatListView.swift | 45 ++++++++++--------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/apps/ios/Shared/Views/ChatList/ChatListView.swift b/apps/ios/Shared/Views/ChatList/ChatListView.swift index 7f6cce6118..69a69ba3e3 100644 --- a/apps/ios/Shared/Views/ChatList/ChatListView.swift +++ b/apps/ios/Shared/Views/ChatList/ChatListView.swift @@ -110,19 +110,18 @@ struct ChatListView: View { } if !chatModel.chats.isEmpty && searchVisible { - VStack { - ChatListSearchBar( - searchMode: $searchMode, - searchFocussed: $searchFocussed, - searchText: $searchText, - searchShowingSimplexLink: $searchShowingSimplexLink, - searchChatFilteredBySimplexLink: $searchChatFilteredBySimplexLink - ) - .scaleEffect(x: 1, y: oneHandUI ? -1 : 1, anchor: .center) - .listRowSeparator(.hidden) - .frame(maxWidth: .infinity) - .padding(10) - } + ChatListSearchBar( + searchMode: $searchMode, + searchFocussed: $searchFocussed, + searchText: $searchText, + searchShowingSimplexLink: $searchShowingSimplexLink, + searchChatFilteredBySimplexLink: $searchChatFilteredBySimplexLink + ) + .scaleEffect(x: 1, y: oneHandUI ? -1 : 1, anchor: .center) + .listRowSeparator(.hidden) + .frame(maxWidth: .infinity) + .padding(10) + .transition(.move(edge: .top)) } } .background(.bar) @@ -139,10 +138,12 @@ struct ChatListView: View { if frame.maxY <= screenHeight && frame.maxY > screenHeight - frame.height / 2 { if topVisibleRowIndex != index { - if let topVisibleRowIndex = topVisibleRowIndex { - searchVisible = topVisibleRowIndex > index || index == 0 - } else { - searchVisible = true + withAnimation { + searchVisible = if let topVisibleRowIndex { + topVisibleRowIndex > index || index == 0 + } else { + true + } } topVisibleRowIndex = index @@ -151,10 +152,12 @@ struct ChatListView: View { } else { if frame.minY >= 0 && frame.minY < frame.height / 2 { if topVisibleRowIndex != index { - if let topVisibleRowIndex = topVisibleRowIndex { - searchVisible = topVisibleRowIndex > index - } else { - searchVisible = true + withAnimation { + searchVisible = if let topVisibleRowIndex { + topVisibleRowIndex > index + } else { + true + } } topVisibleRowIndex = index