onMove stops working if the listStyle is SidebarListStyle()

Viewed 103

I have a very simple macOS app made with swiftui

import SwiftUI
struct ContentView: View {
    @State var array = ["one","two","three"]
    var body: some View {
        NavigationView{
            List{
                ForEach(0..<array.count,id: \.self){ index in
                    Text(array[index])
                }
                .onMove{indexSet,int in
                    array.move(fromOffsets: indexSet, toOffset: int)
                }
            }
            .listStyle(SidebarListStyle())
        }
    }
}

for some reason, you can only drag the first row of the list. if I remove the SidebarListstyle, the problem disappears

0 Answers
Related