SwiftUI animation bug

Originator:fernandomdr
Number:rdar://FB8888551 Date Originated:Nov 8, 2020
Status:Closed Resolved:Yes
Product:SwiftUI Framework Product Version:14.2
Classification: Reproducible:Yes
 
I found a strange behavior on iOS on a SwiftUI app. Basically there is a simple View with a TabView (2 tabs). The first tab contains a TextField and the second tab contains a List.

If you open the app and navigate to the second tab, everything works fine. But if you open the app and first tap on the TextField in the first tab, the keyboard should open, close it and switch to the second tab. This should trigger the bug a really strange UI animation.

To reproduce:

struct ContentView: View {
    @State var search = ""

    var body: some View {
        TabView {
            TextField("", text: $search)
                .textFieldStyle(RoundedBorderTextFieldStyle())
                .tabItem { Text("First") }
            List {
                ForEach(0..<200, id: \.self) { index in
                    HStack {
                        Text("\(index)")
                        Spacer()
                        Image(systemName: "star.fill")
                    }
                }
            }
            .animation(.easeInOut)
            .tabItem { Text("Second") }
        }
    }
}

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!