SwiftUI List NavigationView onDelete alert confirmation has ugly animation

Viewed 291

The problem is that whenever you put the list in navigationView, the animation of the delete cancelation of the list row is not so nice. Am I doing something wrong in my body property?

var body: some View {
    NavigationView {
        VStack {
            List {
                ForEach(self.contacts){ contact in
                    ContactRow(contact: contact)
                }.onDelete { self.setDeletIndex(at: $0) }
            }
            .alert(isPresented: $showConfirm) {
                Alert(title: Text("Delete"), message: Text("Sure?"),
                      primaryButton: .cancel(),
                      secondaryButton: .destructive(Text("Delete")) {
                        
                        self.delete()
                      })
            }
            .listStyle(PlainListStyle())
            .navigationTitle("Contacts")
            .navigationBarItems(trailing: HStack {
                Button("Add", action: self.addItem)
            })
        }
    }
}

enter image description here

0 Answers
Related