File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -87,10 +87,15 @@ export abstract class ViewWithBottomSheetBase extends View {
87
87
} ;
88
88
this . _closeBottomSheetCallback = ( ...originalArgs ) => {
89
89
if ( this . _closeBottomSheetCallback ) {
90
- const callback = this . _closeBottomSheetCallback ;
90
+ // const callback = this._closeBottomSheetCallback;
91
91
this . _closeBottomSheetCallback = null ;
92
92
this . _bottomSheetContext . closeCallback = null ;
93
- this . _hideNativeBottomSheet ( parent , callback ) ;
93
+ const whenClosedCallback = ( ) => {
94
+ if ( typeof options . closeCallback === "function" ) {
95
+ options . closeCallback . apply ( undefined , originalArgs ) ;
96
+ }
97
+ } ;
98
+ this . _hideNativeBottomSheet ( parent , whenClosedCallback ) ;
94
99
}
95
100
} ;
96
101
this . _bottomSheetContext . closeCallback = this . _closeBottomSheetCallback ;
Original file line number Diff line number Diff line change @@ -199,13 +199,14 @@ function initializeBottomSheetDialogFragment() {
199
199
export class ViewWithBottomSheet extends ViewWithBottomSheetBase {
200
200
_bottomSheetFragment : com . google . android . material . bottomsheet . BottomSheetDialogFragment ;
201
201
protected _hideNativeBottomSheet ( parent : View , whenClosedCallback : ( ) => void ) {
202
+ // call whenClosedCallback first because dismiss will call another one (without result)
203
+ whenClosedCallback ( ) ;
202
204
const manager = this . _bottomSheetFragment . getFragmentManager ( ) ;
203
205
if ( manager ) {
204
206
this . _bottomSheetFragment . dismissAllowingStateLoss ( ) ;
205
207
}
206
208
207
209
this . _bottomSheetFragment = null ;
208
- whenClosedCallback ( ) ;
209
210
}
210
211
211
212
protected _showNativeBottomSheet ( parent : View , options : BottomSheetOptions ) {
You can’t perform that action at this time.
0 commit comments