I need to use a picker in a form inside a sheet. But this does not work. If I click on the picker I get not into the selection of the Elements.
struct ContentView: View {
    @State private var showSheet = false
    
    var body: some View {
        Button("Sheet", action: {
            showSheet.toggle()
        })
        .sheet(isPresented: $showSheet, content: {
            SecondView()
        })
    }
}
struct SecondView: View {
    var body: some View {
        Form {
            Picker(selection: .constant(1), label: Text("Picker")) {
                Text("1").tag(1)
                Text("2").tag(2)
            }
        }
    }
}
Any suggestions here?
It requires NavigationView, ie
    .sheet(isPresented: $showSheet, content: {
        NavigationView {
           SecondView()
        }
    })
alternate is to embed Form in NavigationView directly in SecondView.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With