Disable animations on installed profile view

Fixes #836
This commit is contained in:
Davide 2024-11-10 18:21:17 +01:00
parent 44468b5d1f
commit bd4aeed97a
No known key found for this signature in database
GPG Key ID: A48836171C759F5E
3 changed files with 9 additions and 0 deletions

View File

@ -58,6 +58,7 @@ struct ProfileGridView: View, Routable, TunnelInstallationProviding {
if !isSearching {
headerView(scrollProxy: scrollProxy)
.padding(.bottom)
.unanimated()
}
LazyVGrid(columns: columns) {
ForEach(allHeaders, content: profileView)

View File

@ -60,6 +60,7 @@ struct ProfileListView: View, Routable, TunnelInstallationProviding {
Form {
if !isSearching {
headerView(scrollProxy: scrollProxy)
.unanimated()
}
Group {
ForEach(allHeaders, content: profileView)

View File

@ -42,6 +42,13 @@ extension View {
public func opaque(_ condition: Bool) -> some View {
opacity(condition ? 1.0 : 0.0)
}
// https://www.avanderlee.com/swiftui/disable-animations-transactions/
public func unanimated() -> some View {
transaction {
$0.animation = nil
}
}
}
extension ViewModifier {