FB13699023
A conditionally shown DatePicker
with .datePickerStyle(.graphical)
has the time input cutoff until a new selection is made.
Repro steps:
- Tap “Select a date” to show the conditionally hidden DatePicker.
- What happens: The time input is cutoff. What I expect: The time input is not cutoff.
- Choose a new date.
- The time input is shown as expected.
Tested on a 9th gen iPad running 17.4.1, a iPhone 15 Pro Max simulator running 17.4
Using Xcode Version 15.3 (15E204a)
struct ContentView: View {
@State private var selection = Date.now
@State private var isOpen = false
var body: some View {
Button("Select a date") {
isOpen.toggle()
}
if isOpen {
DatePicker("Date Picker", selection: $selection)
.datePickerStyle(.graphical)
}
}
}