Picker stops working when @Environment is added to the View

I have a Form on my View containing couple of Pickers.

Picker stops working when @Environment(\.presentationMode) var presentationMode is added to a View.

struct NewOperationView: View {
    @Environment(\.presentationMode) var presentationMode
    @State var docDate: Date

    @State var doctorID: Int64
    @State var doctors: [listStruct] = []

    @State var refOperationID: Int64
    @State var refOperations: [listStruct] = []

    @State var productsList: [productListStruct] = []

    let df: DateFormatter = DateFormatter()
    let barcodeService = BarcodeService()

    var body: some View {
        VStack {
            Form {
                HStack {
                  Text("Date")
                  Spacer()
                  Text(df.string(from: docDate))
                }
                Picker("Doctor", selection: $doctorID) {
                    ForEach(doctors) { doctor in
                        Text(doctor.title).tag(doctor.id)
                    }
                }
                Picker("Operation", selection: $refOperationID) {
                    ForEach(refOperations) { refOperation in
                        Text(refOperation.title).tag(refOperation.id)
                    }
                }
                Section("Prothesis") {
                    List {
                        ForEach(productsList) { product in
                            ProductRow(product: product)
                        }.onDelete(perform: delete)
                    }
                }
            }
        }
    }
}

Before importing the @Environment all works well, Picker's value is displayed, and selectable. But After importing pickers turns empty, and selecting the value in picker does not change the value of the picker

Before importing

After importing

From what I observed, using environment object may change the way the view is initialized. As you seems to use array State var this may result as the override when calling does not happens as the view may be created before. Use binding if data comes from caller view.

Thank you! Moving the arrays to parent view and passing them as binding to the view - did the trick! :)

Picker stops working when @Environment is added to the View
 
 
Q