@@ -69,41 +69,44 @@ static YGSize RNDateTimePickerShadowViewMeasure(YGNodeConstRef node, float width
6969 }
7070
7171 size = [shadowPickerView.picker sizeThatFits: UILayoutFittingCompressedSize];
72- // iOS DatePicker requires a minimum width of 280 points for proper display
73- // See: https://github.com/react-native-datetimepicker/datetimepicker/issues/1014
74- size.width = MAX (size.width , 280 );
7572
7673 // Check if we're using inline/calendar style
7774 BOOL isInlineStyle = NO ;
7875 if (@available (iOS 14.0 , *)) {
7976 isInlineStyle = shadowPickerView.picker .preferredDatePickerStyle == UIDatePickerStyleInline;
8077 }
8178
82- // Respect the provided width constraint to allow the picker to expand to full width
83- // when a specific width is provided or when measuring at-most mode
79+ // iOS DatePicker requires a minimum width of 280 points for proper display
80+ // UICalendarView (inline) requires a minimum height of 330 points
81+ // See: https://github.com/react-native-datetimepicker/datetimepicker/issues/1014
82+ size.width = MAX (size.width , 280 );
83+ if (isInlineStyle) {
84+ size.height = MAX (size.height , 330 );
85+ }
86+
87+ // Handle width constraints
8488 if (widthMode == YGMeasureModeExactly) {
8589 size.width = width;
8690 } else if (widthMode == YGMeasureModeAtMost) {
87- // For inline/calendar style, try to use the full available width
88- // For other styles, use the minimum width needed
91+ // For inline/calendar style, use the full available width
8992 if (isInlineStyle) {
90- size.width = width; // Use full available width for calendar
93+ size.width = MAX ( 280 , MIN ( width, 500 )) ; // Use available width, max 500pt
9194 } else {
9295 size.width = MIN (size.width + 10 , width);
9396 }
9497 } else {
95- // For undefined mode, add small padding
96- size.width += 10 ;
98+ // For undefined mode with inline style, suggest a larger width
99+ if (isInlineStyle) {
100+ size.width = MAX (size.width , 375 );
101+ } else {
102+ size.width += 10 ;
103+ }
97104 }
98105
99- // UICalendarView (inline style) requires sufficient height to render content
100- // Without this, we get: "UICalendarView's height is smaller than it can render its content in"
106+ // Handle height constraints for inline style
101107 if (isInlineStyle) {
102- size.height = MAX (size.height , 330 );
103-
104- // Respect height constraints if provided
105108 if (heightMode == YGMeasureModeExactly) {
106- size.height = height;
109+ size.height = MAX ( height, 280 ); // Enforce reasonable minimum even for exact mode
107110 } else if (heightMode == YGMeasureModeAtMost) {
108111 size.height = MIN (size.height , height);
109112 }
0 commit comments