Skip to content

Commit 920d230

Browse files
committed
fix(dialogs): another fix for modal over modals
1 parent fb6374e commit 920d230

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/dialogs/dialogs.ios.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ class MDCAlertControllerImpl extends MDCAlertController {
8787
clear: Function;
8888
_resolveFunction?: Function;
8989
_disableContentInsets: boolean;
90+
_savedPreferredContentSize: CGSize
9091
viewDidAppear(animated: boolean) {
9192
super.viewDidAppear(animated);
9293
if (this.autoFocusTextField) {
@@ -104,9 +105,17 @@ class MDCAlertControllerImpl extends MDCAlertController {
104105
viewDidLayoutSubviews() {
105106
// we enforce the bounds first
106107
// when showing a modal on top of us and then hiding the modal, our size gets messed up
108+
if(this._savedPreferredContentSize) {
109+
this.preferredContentSize = this._savedPreferredContentSize;
110+
this._savedPreferredContentSize = null;
111+
}
107112
this.view.bounds = CGRectMake(0, 0, this.preferredContentSize.width, this.preferredContentSize.height);
108113
super.viewDidLayoutSubviews();
109114
}
115+
viewDidDisappear(animated: boolean) {
116+
super.viewDidDisappear(animated);
117+
this._savedPreferredContentSize = this.preferredContentSize;
118+
}
110119
// viewDidUnload is not called anymore
111120
// viewDidUnload() {
112121
// super.viewDidUnload();

0 commit comments

Comments
 (0)