Skip to content

Commit dd7d7b3

Browse files
committed
fix: ios width
1 parent 914c8f2 commit dd7d7b3

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

ios/RNDateTimePickerShadowView.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ 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);
7275
size.width += 10;
7376
});
7477

ios/fabric/RNDateTimePickerComponentView.mm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ - (void) updateMeasurements {
103103
return;
104104
}
105105
CGSize size = [_dummyPicker sizeThatFits:UILayoutFittingCompressedSize];
106+
// iOS DatePicker requires a minimum width of 280 points for proper display
107+
// See: https://github.com/react-native-datetimepicker/datetimepicker/issues/1014
108+
size.width = MAX(size.width, 280);
106109
size.width += 10;
107110
auto newState = RNDateTimePickerState{RCTSizeFromCGSize(size)};
108111
_state->updateState(std::move(newState));

0 commit comments

Comments
 (0)