How to avoid reduced opacity when hiding view with animation in SwiftUI
Issue #679
While redesigning UI for my app Push Hero, I ended up with an accordion style to toggle section.
It worked great so far, but after 1 collapsing, all image and text views have reduced opacity. This does not happen for other elements like dropdown button or text.
1 | extension View { |
The culprit is that withAnimation
, it seems to apply opacity effect. So the workaround is to disable animation wrappedValue
, or to tweak transition so that there’s no opacity adjustment.
1 | if shows.wrappedValue { |