Carterman
Carterman

Reputation: 249

SwiftUI iOS 14 Date Picker Weird Behavior

When selecting a time on iPhone 8, the date picker crashes. TimeZone is an @State variable being changed in a picker. The user is able to selected a date. But when the user selects the time, the date picker collapses, thus the time is not able to be set. I have tested this both on iPhone X and iPhone 12 pro Max, works perfectly.

However Xcode always prints out these to warnings:

The iPhone 8 simulator works as well. Users from TestFlight show feedback and videos of the time not being able to be selected on iPhone 8.

Are these warnings the result in the date picker collapsing? If so how can these warnings be suppressed? Am I using the .environment modifier correctly when setting the timezone?

Down bellow are two date pickers, both of them have the same problem.

Things that I have tried that don't work :

Upvotes: 11

Views: 2410

Answers (1)

Mcrich
Mcrich

Reputation: 125

Try adding .datePickerStyle(CompactDatePickerStyle()) to compact it and then have it popup when clicked

Upvotes: 1

Related Questions