Skip to content

Commit

Permalink
fix: Set PreferredDatePickerStyle on iOS 14
Browse files Browse the repository at this point in the history
  • Loading branch information
kazo0 committed Oct 14, 2020
1 parent 0890aa4 commit 276f230
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ private protected override void OnLoaded()
_picker.Mode = UIDatePickerMode.Date;
_picker.TimeZone = NSTimeZone.LocalTimeZone;
_picker.Calendar = new NSCalendar(NSCalendarType.Gregorian);

if (UIDevice.CurrentDevice.CheckSystemVersion(14, 0))
{
_picker.PreferredDatePickerStyle = UIDatePickerStyle.Wheels;
}

UpdatePickerValue(Date, animated: false);

_picker.ValueChanged += OnPickerValueChanged;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ private protected override void OnLoaded()
_picker.Calendar = new NSCalendar(NSCalendarType.Gregorian);
_picker.Mode = UIDatePickerMode.Time;

if (UIDevice.CurrentDevice.CheckSystemVersion(14, 0))
{
_picker.PreferredDatePickerStyle = UIDatePickerStyle.Wheels;
}

_picker.ValueChanged += OnValueChanged;

var parent = _picker.FindFirstParent<FrameworkElement>();
Expand Down

0 comments on commit 276f230

Please sign in to comment.