Hi,
I am trying to animate a SwiftUI DatePicker in a form. This is my code:
When I tap on the text the DatePicker opens as expected. However when I close it, the DatePicker disappears by sliding into the bottom of the page, when it should slide back into the HStack above it.
Any ideas?
I am trying to animate a SwiftUI DatePicker in a form. This is my code:
Code Block swift HStack { Text("Starts") Spacer() Text(DateHelper.ddMMMMyyyhmmaaFormatter.string(from: self.request.startDate)) .foregroundColor(Color(UIColor.systemGray)) } .onTapGesture { withAnimation { self.isStartPickerOpen.toggle() self.isEndPickerOpen = false } } if self.isStartPickerOpen { DatePicker("", selection: self.$request.startDate.onChange({_ in self.keepStartAndEndInTheSameDay() self.validateDateTimes() })) .datePickerStyle(WheelDatePickerStyle()) .labelsHidden() }
When I tap on the text the DatePicker opens as expected. However when I close it, the DatePicker disappears by sliding into the bottom of the page, when it should slide back into the HStack above it.
Any ideas?