Post

Replies

Boosts

Views

Activity

animation(_:,value:) doesn't work inside TabView with tabViewStyle(.page)
View.animation(_:,value:) doesn't seem to work inside TabView with tabViewStyle(.page). There is no animation when the value changes. The same code works as expected without TabView. I was able to reproduce on iOS 17.5 and iOS 17.2. iOS 16.4 is working correctly. STEPS TO REPRODUCE: Run the attached code Wait for yellow to load Wait for 2 seconds for green to load (there is no animation even though there should be) import SwiftUI struct ContentView: View { @State private var loaded = false var body: some View { TabView { ZStack { if loaded { Color.green } else { Color.yellow } } .animation(.default, value: loaded) .task { do { try await Task.sleep(for: .seconds(2)) loaded = true } catch { // no-op } } } .tabViewStyle(.page) } } Has anyone else seen this behavior?
1
1
239
Aug ’24