@@ -96,6 +96,9 @@ class UIViewControllerImpl extends UIViewController {
9696 trace . write ( owner + " viewWillAppear" , trace . categories . Navigation ) ;
9797 owner . _enableLoadedEvents = true ;
9898
99+ //https://github.com/NativeScript/NativeScript/issues/1201
100+ owner . _viewWillDisappear = false ;
101+
99102 // In iOS we intentionally delay the raising of the 'loaded' event so both platforms behave identically.
100103 // The loaded event must be raised AFTER the page is part of the windows hierarchy and
101104 // frame.topmost().currentPage is set to the page instance.
@@ -108,6 +111,18 @@ class UIViewControllerImpl extends UIViewController {
108111 owner . _enableLoadedEvents = false ;
109112 }
110113
114+ public viewWillDisappear ( ) {
115+ let owner = this . _owner . get ( ) ;
116+ if ( ! owner ) {
117+ return ;
118+ }
119+
120+ trace . write ( owner + " viewWillDisappear" , trace . categories . Navigation ) ;
121+
122+ //https://github.com/NativeScript/NativeScript/issues/1201
123+ owner . _viewWillDisappear = true ;
124+ }
125+
111126 public viewDidDisappear ( ) {
112127 let owner = this . _owner . get ( ) ;
113128 if ( ! owner ) {
@@ -128,9 +143,10 @@ class UIViewControllerImpl extends UIViewController {
128143export class Page extends pageCommon . Page {
129144 private _ios : UIViewController ;
130145 public _enableLoadedEvents : boolean ;
131- public _isModal : boolean = false ;
132- public _UIModalPresentationFormSheet : boolean = false ;
133- public _delayLoadedEvent ;
146+ public _isModal : boolean ;
147+ public _UIModalPresentationFormSheet : boolean ;
148+ public _delayLoadedEvent : boolean ;
149+ public _viewWillDisappear : boolean ;
134150
135151 constructor ( options ?: definition . Options ) {
136152 super ( options ) ;
0 commit comments