Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions ios/RNDateTimePickerShadowView.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ static YGSize RNDateTimePickerShadowViewMeasure(YGNodeRef node, float width, YGM

__block CGSize size;
dispatch_sync(dispatch_get_main_queue(), ^{
if (@available(iOS 14.0, *)) {
// if this is not reset to the default before setting style it can result in a crash
// use case: picker was first shown with mode that is not UIDatePickerModeCountDownTimer then
// displayed again in different UI with mode UIDatePickerModeCountDownTimer
[shadowPickerView.picker setDatePickerMode:UIDatePickerModeDateAndTime];
[shadowPickerView.picker setPreferredDatePickerStyle:shadowPickerView.displayIOS];
}
[shadowPickerView.picker setDate:shadowPickerView.date];
[shadowPickerView.picker setDatePickerMode:shadowPickerView.mode];
[shadowPickerView.picker setLocale:shadowPickerView.locale];
Expand Down