I’ve a date picker inside a backside sheet view.
When the underside sheet opens, the primary time I select a day, the date picker peak modifications.
P.S: If I set a customized peak for the picker utilizing .body, the date picker simply turns into smooshed contained in the body.
var physique: some View {
VStack {
HStack {
Textual content("date_picker_title".ld())
.font(.customized(Font.rRegular, measurement: 12))
.padding()
Spacer()
}
HStack {
Textual content(date.prettyDate)
.font(.customized(Font.rMedium, measurement: 28))
Spacer()
Textual content(date.prettyHour)
.font(.customized(Font.rMedium, measurement: 28))
}.padding(.horizontal)
Seperator(cellHeight: 0).body(peak: 2)
Spacer().body(peak: 6)
DatePicker("", choice: $date, in: Date()..., displayedComponents: .date)
.datePickerStyle(.graphical)
.labelsHidden()
.tint(Shade.appPurple)
.padding(.horizontal)
.padding(.backside, -10)
Seperator(cellHeight: 0).body(peak: 2)
HStack {
Textual content("date_picker_enter_time".ld())
.font(.customized(Font.rRegular, measurement: 12))
DatePicker("", choice: $date, displayedComponents: .hourAndMinute)
.labelsHidden()
.tint(Shade.appPurple)
Spacer()
}.padding()
HStack {
Button {
completion(nil)
} label: {
Textual content("date_picker_cancel".ld())
.font(.customized(Font.rRegular, measurement: 14))
.foregroundColor(Shade.appPurple)
}
Spacer()
Button {
completion(date)
} label: {
Textual content("date_picker_ok".ld())
.font(.customized(Font.rRegular, measurement: 14))
.foregroundColor(Shade.appPurple)
}
}.padding(.horizontal)
Spacer().body(peak: 50)
}
.body(maxWidth: .infinity)
.background(Shade.appLightPurple)
.padding(.backside, -50)
}