@@ -16,6 +16,7 @@ import { ProxyViewContainer } from "tns-core-modules/ui/proxy-view-container/pro
16
16
import { AppHostView } from "../app-host-view" ;
17
17
import { DetachedLoader } from "../common/detached-loader" ;
18
18
import { PageFactory , PAGE_FACTORY } from "../platform-providers" ;
19
+ import { once } from "../common/utils" ;
19
20
20
21
export interface ModalDialogOptions {
21
22
context ?: any ;
@@ -106,19 +107,17 @@ export class ModalDialogService {
106
107
let componentView : View ;
107
108
let detachedLoaderRef : ComponentRef < DetachedLoader > ;
108
109
109
- const closeCallback = ( ...args ) => {
110
+ const closeCallback = once ( ( ...args ) => {
110
111
doneCallback . apply ( undefined , args ) ;
111
- if ( componentView && ! this . location . _isModalClosing ) {
112
+ if ( componentView ) {
112
113
this . location . _beginCloseModalNavigation ( ) ;
113
-
114
114
componentView . closeModal ( ) ;
115
- } else if ( this . location . _isModalClosing ) {
116
115
this . location . back ( ) ;
117
116
this . location . _finishCloseModalNavigation ( ) ;
118
117
detachedLoaderRef . instance . detectChanges ( ) ;
119
118
detachedLoaderRef . destroy ( ) ;
120
119
}
121
- } ;
120
+ } ) ;
122
121
123
122
const modalParams = new ModalDialogParams ( context , closeCallback ) ;
124
123
const providers = ReflectiveInjector . resolve ( [
@@ -141,7 +140,7 @@ export class ModalDialogService {
141
140
}
142
141
143
142
// TODO: remove <any> cast after https://github.com/NativeScript/NativeScript/pull/5734
144
- // is in a published version of tns-core-modules.
143
+ // is in a published version of tns-core-modules.
145
144
( < any > parentView ) . showModal ( componentView , context , closeCallback , fullscreen , animated , stretched ) ;
146
145
} ) ;
147
146
}
0 commit comments