@@ -93,15 +93,14 @@ export class DateTimePicker extends DateTimePickerBase {
9393 static _createNativeDialog ( nativePicker : UIDatePicker , options : PickerOptions , style : DateTimePickerStyle , callback : Function ) {
9494 const alertTitle = options . title ? options . title : '' ;
9595 const alertController = UIAlertController . alertControllerWithTitleMessagePreferredStyle ( alertTitle , DateTimePicker . PICKER_DEFAULT_MESSAGE , UIAlertControllerStyle . ActionSheet ) ;
96- const alertSize = nativePicker . preferredDatePickerStyle === 3 ? 280 : Math . min ( alertController . view . frame . size . width , alertController . view . frame . size . height ) ;
97- const pickerViewWidth = UIDevice . currentDevice . userInterfaceIdiom === UIUserInterfaceIdiom . Pad ? DateTimePicker . PICKER_WIDTH_PAD : alertSize - DateTimePicker . PICKER_WIDTH_INSETS ;
9896
9997 let pickerContainerFrameTop = options . title ? DateTimePicker . PICKER_DEFAULT_TITLE_OFFSET : DateTimePicker . PICKER_DEFAULT_OFFSET ;
10098 if ( options . title ) {
10199 pickerContainerFrameTop += DateTimePicker . PICKER_DEFAULT_TITLE_HEIGHT ;
102100 }
103101 const pickerViewHeight = DateTimePicker . PICKER_DEFAULT_MESSAGE_HEIGHT ;
104102 const pickerContainer = UIView . alloc ( ) . init ( ) ;
103+ pickerContainer . clipsToBounds = false ;
105104 let spinnersBackgroundColor = new Color ( 'transparent' ) ;
106105 let spinnersTextColor = null ;
107106 if ( style ) {
@@ -111,18 +110,14 @@ export class DateTimePicker extends DateTimePickerBase {
111110 DateTimePicker . _applyDialogSpinnersColors ( nativePicker , pickerContainer , spinnersTextColor , spinnersBackgroundColor ) ;
112111
113112 const pickerView = nativePicker ;
114- const left = this . _isTablet ? 0 : ( alertController . view . frame . size . width - pickerViewWidth ) / 2 - DateTimePicker . PICKER_WIDTH_INSETS ;
115- pickerView . frame = CGRectMake ( left , 0 , pickerViewWidth , pickerViewHeight ) ;
113+ pickerView . clipsToBounds = false ;
116114 pickerContainer . addSubview ( pickerView ) ;
117115 DateTimePicker . _clearVibrancyEffects ( alertController . view ) ;
118116
119117 const messageLabel = DateTimePicker . _findLabelWithText ( alertController . view , DateTimePicker . PICKER_DEFAULT_MESSAGE ) ;
120118 const messageLabelContainer = DateTimePicker . _getLabelContainer ( messageLabel ) ;
121- if ( this . _isTablet ) {
122- messageLabelContainer . clipsToBounds = false ;
123- } else {
124- messageLabelContainer . clipsToBounds = true ;
125- }
119+ // Disable clipping on all ancestor views to prevent wheel picker from being cut off
120+ DateTimePicker . _disableClipsToBoundsOnAncestors ( messageLabelContainer ) ;
126121 messageLabelContainer . addSubview ( pickerContainer ) ;
127122
128123 pickerContainer . translatesAutoresizingMaskIntoConstraints = false ;
@@ -131,13 +126,13 @@ export class DateTimePicker extends DateTimePickerBase {
131126 pickerContainer . rightAnchor . constraintEqualToAnchor ( alertController . view . rightAnchor ) . active = true ;
132127 pickerContainer . bottomAnchor . constraintEqualToAnchor ( alertController . view . bottomAnchor ) . active = true ;
133128
134- if ( nativePicker . preferredDatePickerStyle === 3 ) {
135- pickerView . centerXAnchor . constraintEqualToAnchor ( pickerContainer . centerXAnchor ) . active = true ;
136- // pickerView.leftAnchor.constraintEqualToAnchorConstant (pickerContainer.leftAnchor, left ).active = true;
137- } else {
138- pickerView . leftAnchor . constraintLessThanOrEqualToAnchorConstant ( pickerContainer . leftAnchor , DateTimePicker . PICKER_WIDTH_INSETS ) . active = true ;
139- pickerView . rightAnchor . constraintLessThanOrEqualToAnchorConstant ( pickerContainer . rightAnchor , DateTimePicker . PICKER_WIDTH_INSETS ) . active = true ;
140- }
129+ // Use auto layout for the picker - constrain to container edges to prevent clipping
130+ pickerView . translatesAutoresizingMaskIntoConstraints = false ;
131+ pickerView . topAnchor . constraintEqualToAnchor ( pickerContainer . topAnchor ) . active = true ;
132+ pickerView . heightAnchor . constraintEqualToConstant ( pickerViewHeight ) . active = true ;
133+ // Constrain left and right edges with insets to keep picker within bounds
134+ pickerView . leftAnchor . constraintEqualToAnchorConstant ( pickerContainer . leftAnchor , DateTimePicker . PICKER_WIDTH_INSETS ) . active = true ;
135+ pickerView . rightAnchor . constraintEqualToAnchorConstant ( pickerContainer . rightAnchor , - DateTimePicker . PICKER_WIDTH_INSETS ) . active = true ;
141136
142137 const cancelButtonText = options . cancelButtonText ? options . cancelButtonText : 'Cancel' ;
143138 const okButtonText = options . okButtonText ? options . okButtonText : 'OK' ;
@@ -253,6 +248,14 @@ export class DateTimePicker extends DateTimePickerBase {
253248 return DateTimePicker . _getLabelContainer ( uiView . superview ) ;
254249 }
255250
251+ private static _disableClipsToBoundsOnAncestors ( uiView : UIView ) {
252+ let current = uiView ;
253+ while ( current ) {
254+ current . clipsToBounds = false ;
255+ current = current . superview ;
256+ }
257+ }
258+
256259 private static _findLabelWithText ( uiView : UIView , text : string ) {
257260 if ( uiView instanceof UILabel && uiView . text === text ) {
258261 return uiView ;
0 commit comments