File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -104,6 +104,21 @@ - (void) updateMeasurements {
104104 }
105105 CGSize size = [_dummyPicker sizeThatFits: UILayoutFittingCompressedSize];
106106 size.width += 10 ;
107+
108+ // Workaround: sizeThatFits: returns incorrect height for
109+ // UIDatePickerModeDateAndTime + UIDatePickerStyleInline (Apple bug).
110+ // The returned height only accounts for the calendar, missing the time row.
111+ if (@available (iOS 14.0 , *)) {
112+ if (_dummyPicker.datePickerMode == UIDatePickerModeDateAndTime &&
113+ _dummyPicker.preferredDatePickerStyle == UIDatePickerStyleInline) {
114+ UIDatePicker *timePicker = [UIDatePicker new ];
115+ timePicker.datePickerMode = UIDatePickerModeTime;
116+ timePicker.preferredDatePickerStyle = UIDatePickerStyleInline;
117+ CGSize timeSize = [timePicker sizeThatFits: UILayoutFittingCompressedSize];
118+ size.height += timeSize.height ;
119+ }
120+ }
121+
107122 auto newState = RNDateTimePickerState{RCTSizeFromCGSize (size)};
108123 _state->updateState (std::move (newState));
109124}
You can’t perform that action at this time.
0 commit comments