As long as the datePicker selection is closed, everything is fine. When the calendar sheet is left open, and the dismiss (.onTapGesture) is pressed, the onDismiss closure is done, but the screen will not return. Tried setting the isPresenting to false in the didDismiss() with the same results.
getting this error
[序言] ∗∗∗∗∗
参考了这些文件,并增加了一个日期,使事情变得简单。
struct FullScreenCoverPresentedOnDismiss: View {
@State private var isPresenting = false
@State private var birthDate = Date()
var body: some View {
Button("Present Full-Screen Cover") {
isPresenting.toggle()
}
.fullScreenCover(isPresented: $isPresenting,
onDismiss: didDismiss) {
VStack {
DatePicker(selection: $birthDate, in: ...Date(), displayedComponents: .date) {
Text("Select a date")
}
Text("A full-screen modal view.")
.font(.title)
Text("Tap to Dismiss")
.onTapGesture {
isPresenting.toggle()
}
}
.foregroundColor(.white)
.frame(maxWidth: .infinity,
maxHeight: .infinity)
.background(Color.blue)
.ignoresSafeArea(edges: .all)
}
}
func didDismiss() {
print("didDismiss")
}
}