@@ -27,8 +27,7 @@ export { capitalizationType, inputType };
27
27
28
28
const UIViewAutoSizeUIViewAutoSize = ( UIView as any ) . extend ( {
29
29
systemLayoutSizeFittingSizeWithHorizontalFittingPriorityVerticalFittingPriority ( boundsSize : CGSize ) {
30
-
31
- const actualWidth = Math . min ( boundsSize . width , Screen . mainScreen . widthPixels ) ;
30
+ const actualWidth = Math . min ( boundsSize . width , Screen . mainScreen . widthPixels ) ;
32
31
const widthSpec = Utils . layout . makeMeasureSpec ( Utils . layout . toDevicePixels ( actualWidth ) , Utils . layout . EXACTLY ) ;
33
32
const heighthSpec = Utils . layout . makeMeasureSpec ( Utils . layout . toDevicePixels ( boundsSize . height ) , Utils . layout . UNSPECIFIED ) ;
34
33
const view = this . _view as View ;
@@ -42,7 +41,7 @@ const UIViewAutoSizeUIViewAutoSize = (UIView as any).extend({
42
41
const view = this . _view as View ;
43
42
const size = this . frame . size ;
44
43
View . layoutChild ( null , view , 0 , 0 , Utils . layout . toDevicePixels ( size . width ) , Utils . layout . toDevicePixels ( size . height ) ) ;
45
- }
44
+ } ,
46
45
} ) ;
47
46
48
47
function createUIViewAutoSizeUIViewAutoSize ( view : View ) {
@@ -166,7 +165,13 @@ function addButtonsToAlertController(alertController: MDCAlertController, option
166
165
167
166
function createAlertController ( options : DialogOptions & MDCAlertControlerOptions , resolve ?: Function ) {
168
167
const alertController = MDCAlertControllerImpl . alloc ( ) . init ( ) as IMDCAlertControllerImpl ;
169
-
168
+ const colorScheme = themer . getAppColorScheme ( ) as MDCSemanticColorScheme ;
169
+ const scheme = MDCContainerScheme . alloc ( ) . init ( ) ;
170
+ if ( colorScheme ) {
171
+ scheme . colorScheme = colorScheme ;
172
+ }
173
+ // Step 3: Apply the container scheme to your component using the desired alert style
174
+ alertController . applyThemeWithScheme ( scheme ) ;
170
175
if ( options . title ) {
171
176
alertController . title = options . title ;
172
177
}
@@ -253,9 +258,9 @@ function createAlertController(options: DialogOptions & MDCAlertControlerOptions
253
258
view . bindingContext = fromObject ( context ) ;
254
259
alertController . accessoryView = createUIViewAutoSizeUIViewAutoSize ( view ) ;
255
260
// if no title or message disable contentInsets to be like android
256
- if ( ! options . title && ! options . message ) {
257
- ( alertController as any ) . disableContentInsets = true ;
258
- }
261
+ // if (!options.title && !options.message) {
262
+ // (alertController as any).disableContentInsets = true;
263
+ // }
259
264
view . viewController = alertController ; // needed to prevent a crash in layoutChild
260
265
}
261
266
const dialogPresentationControllerDelegate = MDCDialogPresentationControllerDelegateImpl . initWithCallback ( ( ) => {
@@ -301,9 +306,9 @@ export class AlertDialog {
301
306
alertController : MDCAlertController ;
302
307
presentingController : UIViewController ;
303
308
constructor ( private options : any ) { }
304
- show ( ) {
309
+ show ( resolve ? ) {
305
310
if ( ! this . alertController ) {
306
- this . alertController = createAlertController ( this . options ) ;
311
+ this . alertController = createAlertController ( this . options , resolve ) ;
307
312
this . presentingController = showUIAlertController ( this . alertController ) ;
308
313
}
309
314
}
0 commit comments