@@ -2,8 +2,7 @@ import { ComponentFactoryResolver, ComponentRef, Injectable, Injector, Type, Vie
2
2
import { DetachedLoader } from '@nativescript/angular/common/detached-loader' ;
3
3
import { AppHostView } from '@nativescript/angular/app-host-view' ;
4
4
import { 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' ;
7
6
import { Observable , Subject } from 'rxjs' ;
8
7
import { filter , first , map } from 'rxjs/operators' ;
9
8
import { ProxyViewContainer } from '@nativescript/core/ui/proxy-view-container' ;
@@ -34,6 +33,10 @@ export class BottomSheetService {
34
33
private currentId = 0 ;
35
34
36
35
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 } {
37
40
if ( ! options . viewContainerRef ) {
38
41
throw new Error ( 'No viewContainerRef: Make sure you pass viewContainerRef in BottomSheetOptions.' ) ;
39
42
}
@@ -53,11 +56,14 @@ export class BottomSheetService {
53
56
} ) ;
54
57
} ) ;
55
58
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
+ } ;
61
67
}
62
68
63
69
private getParentView ( viewContainerRef : ViewContainerRef ) : ViewWithBottomSheetBase {
0 commit comments