@@ -45,12 +45,15 @@ export abstract class ViewWithBottomSheetBase extends View {
45
45
eventName : shownInBottomSheetEvent ,
46
46
object : this ,
47
47
context : this . _bottomSheetContext ,
48
- closeCallback : this . _closeBottomSheetCallback
48
+ closeCallback : this . _closeBottomSheetCallback ,
49
49
} ;
50
50
51
51
this . notify ( args ) ;
52
52
}
53
53
public _bottomSheetClosed ( ) : void {
54
+ const _rootModalViews = this . _getRootModalViews ( ) ;
55
+ const modalIndex = _rootModalViews . indexOf ( this ) ;
56
+ _rootModalViews . splice ( modalIndex ) ;
54
57
this . _tearDownUI ( ) ;
55
58
// if a frame _removeFromFrameStack will be called from _tearDownUI
56
59
// if (this instanceof Frame) {
@@ -63,6 +66,7 @@ export abstract class ViewWithBottomSheetBase extends View {
63
66
}
64
67
protected abstract _showNativeBottomSheet ( parent : View , options : BottomSheetOptions ) ;
65
68
protected _commonShowNativeBottomSheet ( parent : View , options : BottomSheetOptions ) {
69
+ this . _getRootModalViews ( ) . push ( this ) ;
66
70
options . context = options . context || { } ;
67
71
this . _bottomSheetContext = options . context ;
68
72
this . _onDismissBottomSheetCallback = ( ...originalArgs ) => {
@@ -84,6 +88,7 @@ export abstract class ViewWithBottomSheetBase extends View {
84
88
if ( ! this . _closeBottomSheetCallback ) {
85
89
return ;
86
90
}
91
+
87
92
// const callback = this._closeBottomSheetCallback;
88
93
this . _closeBottomSheetCallback = null ;
89
94
if ( this . _bottomSheetContext ) {
@@ -103,7 +108,7 @@ export abstract class ViewWithBottomSheetBase extends View {
103
108
eventName : showingInBottomSheetEvent ,
104
109
object : this ,
105
110
context : this . _bottomSheetContext ,
106
- closeCallback : this . _closeBottomSheetCallback
111
+ closeCallback : this . _closeBottomSheetCallback ,
107
112
} ;
108
113
this . notify ( args ) ;
109
114
}
@@ -123,12 +128,15 @@ export abstract class ViewWithBottomSheetBase extends View {
123
128
if ( arguments . length === 0 ) {
124
129
throw new Error ( 'showModal without parameters is deprecated. Please call showModal on a view instance instead.' ) ;
125
130
} else {
126
- const view = options . view instanceof View ? ( options . view as ViewWithBottomSheetBase ) : Builder . createViewFromEntry ( {
127
- moduleName : options . view as string
128
- } ) as ViewWithBottomSheetBase ;
131
+ const view =
132
+ options . view instanceof View
133
+ ? ( options . view as ViewWithBottomSheetBase )
134
+ : ( Builder . createViewFromEntry ( {
135
+ moduleName : options . view as string ,
136
+ } ) as ViewWithBottomSheetBase ) ;
129
137
view . cssClasses . add ( CSSUtils . MODAL_ROOT_VIEW_CSS_CLASS ) ;
130
138
const modalRootViewCssClasses = CSSUtils . getSystemCssClasses ( ) ;
131
- modalRootViewCssClasses . forEach ( c => view . cssClasses . add ( c ) ) ;
139
+ modalRootViewCssClasses . forEach ( ( c ) => view . cssClasses . add ( c ) ) ;
132
140
133
141
view . _showNativeBottomSheet ( this , options ) ;
134
142
return view ;
0 commit comments