FocusState and pickers error

Hello, since the last version of iOS and WatchOS I have a problem with this code.

This is the minimal version of the code, it have two pickers inside a view of a WatchOS App.

The problem its with the focus, I can't change the focus from the first picker to the second one.

As I said before, it was working perfectly in WatchOS 10.0 but in 11 the problems started.

struct ParentView: View {
    @FocusState private var focusedField: String? 

    var body: some View {
        VStack {
            ChildView1(focusedField: $focusedField)
            ChildView2(focusedField: $focusedField)
        }
    }
}

struct ChildView1: View {
    @FocusState.Binding var focusedField: String?
    @State private var selectedValue: Int = 0

    var body: some View {
        Picker("First Picker", selection: $selectedValue) {
            ForEach(0..<5) { index in
                Text("Option \(index)").tag("child\(index)")
            }
        }.pickerStyle(WheelPickerStyle()).focused($focusedField, equals: "first")
    }
}

struct ChildView2: View {
    @FocusState.Binding var focusedField: String?
    @State private var selectedValue: Int = 0

    var body: some View {
        Picker("Second Picker", selection: $selectedValue) {
            ForEach(0..<5) { index in
                Text("Option \(index)").tag("childTwo\(index)")
            }
        }.pickerStyle(WheelPickerStyle()).focused($focusedField, equals: "second")
    }
}

When you do vertical scrolling on the second picker, the focus should be on it, but it dosnt anything.

I try even do manually, setting the focusState to the second one, but it sets itself to nil.

I hope that you can help me, thanks!

The code from the first message works well, the problem its when its in a TabView with pagination in vertical page

struct ContentView: View {
    @State var selection: Int = 1

    var body: some View {
            TabView(selection: $selection) {
                Text("VIEW-ONE").tag(1)
                ParentView().tag(2)
        }.tabViewStyle(.verticalPage)  // <---- THIS LINE
    }
}

struct ParentView: View {
    @FocusState private var focusedField: String?

    var body: some View {
        VStack {
            ChildView1(focusedField: $focusedField)
            ChildView2(focusedField: $focusedField)
        }
    }
}

struct ChildView1: View {
    @FocusState.Binding var focusedField: String?
    @State private var selectedValue: Int = 0

    var body: some View {
        Picker("First Picker", selection: $selectedValue) {
            ForEach(0..<5) { index in
                Text("Option \(index)").tag("child\(index)")
            }
        }.pickerStyle(WheelPickerStyle()).focused($focusedField, equals: "first")
    }
}

struct ChildView2: View {
    @FocusState.Binding var focusedField: String?
    @State private var selectedValue: Int = 0

    var body: some View {
        Picker("Second Picker", selection: $selectedValue) {
            ForEach(0..<5) { index in
                Text("Option \(index)").tag("childTwo\(index)")
            }
        }.pickerStyle(WheelPickerStyle()).focused($focusedField, equals: "second")
    }
}

This seems to be a bug on the system side. If you don't you mind, I’d suggest that you file a feedback report for the SwiftUI folks to investigate – If you do so, please share your report ID here for folks to track.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

Thanks for your reply.

I already submitted the feedback with number FB15723557.

We will wait to new updates then.

Best regards, Jose Antonio,

In the last WatchOS version 11.2 the bug stills, I know that its a rare case use of the pickers so i think that it wont be fix soon.

But this component its the main input data of my app, so my app its almost unusable with a very very bad user experience, so please could you provide a workaround to fix this?

FocusState and pickers error
 
 
Q