SwipeAction does not work in TabView SwiftUI

971 views Asked by At

I have List in the TabView. List has text/button with delete and update swipe action. The swipe action does not work in the tabview but it is work fine without tab view. Below is my code.

  TabView {
     List {
        ForEach(0..<5, id: \.self) {index in
            Text(“\(index)”)
                .swipeActions(edge: .trailing, allowsFullSwipe: false) {
                    Button {
                        
                    } label: {
                        Label {
                            Text("Delete")
                        } icon: {
                            Image("ic_delete")
                                .renderingMode(.template)
                                .foregroundColor(.white)
                        }
                    }
                    .tint(.red)
                    Button {
                        
                    } label: {
                        Label {
                            Text("Update")
                        } icon: {
                            Image("ic_edit")
                                .renderingMode(.template)
                                .foregroundColor(.white)
                        }
                    }
                    .tint(.accentColor)
                }
}
}
        }
    .tabViewStyle(.page(indexDisplayMode: .never))

Can Anyone help me to fix this issue?

0

There are 0 answers