Skip to content

Commit 35bc6a0

Browse files
committed
chore(dialogs): **iOS** ensure loadView is not called too many times
1 parent a8a588b commit 35bc6a0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/dialogs/dialogs.ios.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class UIViewAutoSizeUIViewAutoSize extends UIView {
3333
if (!view) {
3434
return CGSizeZero;
3535
}
36-
// if message is set on the dialog
36+
// if message is set on the dialog
3737
// this is called with an infinite boundsSize.width which would
3838
// make the view size itself to as big as possible
3939
// which we never want
@@ -65,7 +65,6 @@ function createUIViewAutoSizeUIViewAutoSize(view: View) {
6565
view._setupAsRootView({});
6666
view.parent = Application.getRootView();
6767
view._isAddedToNativeVisualTree = true;
68-
view.callLoaded();
6968
self._view = view;
7069
self.addSubview(view.nativeViewProtected);
7170
(view.nativeViewProtected as UIView).autoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
@@ -106,6 +105,11 @@ class MDCAlertControllerImpl extends MDCAlertController {
106105
}
107106
viewDidLoad() {
108107
super.viewDidLoad();
108+
// we call callLoaded here to prevent callLoaded from triggering loadView to be called
109+
// again from callLoaded in loadView (controller.view would not be set yet)
110+
if (this.accessoryView instanceof UIViewAutoSizeUIViewAutoSize) {
111+
this.accessoryView._view.callLoaded();
112+
}
109113
if (this._disableContentInsets) {
110114
(this.view as MDCAlertControllerView).contentInsets = UIEdgeInsetsZero;
111115
}

0 commit comments

Comments
 (0)