@@ -78,6 +78,7 @@ declare class IMDCAlertControllerImpl extends MDCAlertController {
78
78
_resolveFunction ?: Function ;
79
79
actions : NSArray < any > ;
80
80
viewLayedOut : boolean ;
81
+ _disableContentInsets : boolean ;
81
82
}
82
83
const MDCAlertControllerImpl = ( MDCAlertController as any ) . extend ( {
83
84
viewDidAppear ( ) {
@@ -105,7 +106,8 @@ const MDCAlertControllerImpl = (MDCAlertController as any).extend({
105
106
} ,
106
107
viewDidLoad ( ) {
107
108
this . super . viewDidLoad ( ) ;
108
- if ( this . disableContentInsets ) {
109
+ if ( this . _disableContentInsets ) {
110
+ console . log ( 'removing contentInsets' ) ;
109
111
( this . view as MDCAlertControllerView ) . contentInsets = UIEdgeInsetsZero ;
110
112
}
111
113
} ,
@@ -257,10 +259,16 @@ function createAlertController(options: DialogOptions & MDCAlertControlerOptions
257
259
} ;
258
260
view . bindingContext = fromObject ( context ) ;
259
261
alertController . accessoryView = createUIViewAutoSizeUIViewAutoSize ( view ) ;
262
+
260
263
// if no title or message disable contentInsets to be like android
261
- // if (!options.title && !options.message) {
262
- // (alertController as any).disableContentInsets = true;
263
- // }
264
+ if ( ! options . title && ! options . message ) {
265
+ if ( alertController . view ) {
266
+ ( alertController . view as MDCAlertControllerView ) . contentInsets = UIEdgeInsetsZero ;
267
+ } else {
268
+ alertController . _disableContentInsets = true ;
269
+
270
+ }
271
+ }
264
272
view . viewController = alertController ; // needed to prevent a crash in layoutChild
265
273
}
266
274
const dialogPresentationControllerDelegate = MDCDialogPresentationControllerDelegateImpl . initWithCallback ( ( ) => {
0 commit comments