@@ -2,8 +2,7 @@ import { ComponentFactoryResolver, ComponentRef, Injectable, Injector, Type, Vie
22import { DetachedLoader } from '@nativescript/angular/common/detached-loader' ;
33import { AppHostView } from '@nativescript/angular/app-host-view' ;
44import { once } from '@nativescript/angular/common/utils' ;
5- import { BottomSheetOptions as MaterialBottomSheetOptions } from '../bottomsheet-common' ;
6- import { ViewWithBottomSheetBase } from '../bottomsheet-common' ;
5+ import { BottomSheetOptions as MaterialBottomSheetOptions , ViewWithBottomSheetBase } from '../bottomsheet-common' ;
76import { Observable , Subject } from 'rxjs' ;
87import { filter , first , map } from 'rxjs/operators' ;
98import { ProxyViewContainer } from '@nativescript/core/ui/proxy-view-container' ;
@@ -34,6 +33,10 @@ export class BottomSheetService {
3433 private currentId = 0 ;
3534
3635 show < T = any > ( type : Type < any > , options : BottomSheetOptions ) : Observable < T > {
36+ return this . showWithCloseCallback ( type , options ) . observable ;
37+ }
38+
39+ showWithCloseCallback < T = any > ( type : Type < any > , options : BottomSheetOptions ) : { observable : Observable < T > , closeCallback : ( ) => void } {
3740 if ( ! options . viewContainerRef ) {
3841 throw new Error ( 'No viewContainerRef: Make sure you pass viewContainerRef in BottomSheetOptions.' ) ;
3942 }
@@ -53,11 +56,14 @@ export class BottomSheetService {
5356 } ) ;
5457 } ) ;
5558
56- return this . subject$ . pipe (
57- filter ( item => item && item . requestId === requestId ) ,
58- map ( item => item . result ) ,
59- first ( )
60- ) ;
59+ return {
60+ observable : this . subject$ . pipe (
61+ filter ( item => item && item . requestId === requestId ) ,
62+ map ( item => item . result ) ,
63+ first ( )
64+ ) ,
65+ closeCallback : bottomSheetParams . closeCallback
66+ } ;
6167 }
6268
6369 private getParentView ( viewContainerRef : ViewContainerRef ) : ViewWithBottomSheetBase {
0 commit comments