0

Does any one know a workaround (as I assume this is a bug).

Trying to open Time portion of DatePicker while another menu styled picker is opened breaks the whole DatePicker:

  • The Time menu does not open.
  • The Time part changes color to foreground color.
  • The Date part also stops working and changes color to foreground after tapping.

Video from simulator iPhone 15 Pro (17.5). Reproduced on iPhone 13 Pro (iOS 17.5.1).

struct DatePickerIssueView: View {
    @State private var date: Date = Date()
    @State private var option: String = "Option 1"
    
    var body: some View {
        HStack(alignment: .center) {
            DatePicker(
                "",
                selection: $date,
                displayedComponents: [.date, .hourAndMinute]
            )
            Spacer()
            Picker("", selection: $option) {
                ForEach([
                    "Option 1",
                    "Option 2"
                ], id: \.self) { optionValue in
                    Text(optionValue)
                        .tag(optionValue)
                }
            }
        }
    }
}

Video showing the issue

0

Browse other questions tagged or ask your own question.