@@ -187,17 +187,20 @@ export class NavControllerBase extends Ion implements NavController {
187
187
}
188
188
189
189
ti . resolve = ( hasCompleted : boolean , isAsync : boolean , enteringName : string , leavingName : string , direction : string ) => {
190
+ this . setTransitioning ( false ) ;
191
+
190
192
// transition has successfully resolved
191
193
this . _trnsId = null ;
192
194
resolve && resolve ( hasCompleted , isAsync , enteringName , leavingName , direction ) ;
193
195
this . _sbCheck ( ) ;
194
196
195
197
// let's see if there's another to kick off
196
- this . setTransitioning ( false ) ;
197
198
this . _nextTrns ( ) ;
198
199
} ;
199
200
200
201
ti . reject = ( rejectReason : any , trns : Transition ) => {
202
+ this . setTransitioning ( false ) ;
203
+
201
204
// rut row raggy, something rejected this transition
202
205
this . _trnsId = null ;
203
206
this . _queue . length = 0 ;
@@ -218,7 +221,6 @@ export class NavControllerBase extends Ion implements NavController {
218
221
219
222
reject && reject ( false , false , rejectReason ) ;
220
223
221
- this . setTransitioning ( false ) ;
222
224
this . _nextTrns ( ) ;
223
225
} ;
224
226
@@ -390,17 +392,9 @@ export class NavControllerBase extends Ion implements NavController {
390
392
// batch all of lifecycles together
391
393
var view = destroyQueue [ i ] ;
392
394
if ( view && view !== enteringView && view !== leavingView ) {
393
- view . _willLeave ( ) ;
394
- this . viewWillLeave . emit ( view ) ;
395
- this . _app . viewWillLeave . emit ( view ) ;
396
-
397
- view . _didLeave ( ) ;
398
- this . viewDidLeave . emit ( view ) ;
399
- this . _app . viewDidLeave . emit ( view ) ;
400
-
401
- view . _willUnload ( ) ;
402
- this . viewWillUnload . emit ( view ) ;
403
- this . _app . viewWillUnload . emit ( view ) ;
395
+ this . _willLeave ( view ) ;
396
+ this . _didLeave ( view ) ;
397
+ this . _willUnload ( view ) ;
404
398
}
405
399
}
406
400
for ( var i = 0 ; i < destroyQueue . length ; i ++ ) {
@@ -571,20 +565,19 @@ export class NavControllerBase extends Ion implements NavController {
571
565
572
566
_viewInsert ( view : ViewController , componentRef : ComponentRef < any > , viewport : ViewContainerRef ) {
573
567
// successfully finished loading the entering view
574
- // fire off the "loaded" lifecycle events
575
- view . _didLoad ( ) ;
576
- this . viewDidLoad . emit ( view ) ;
577
- this . _app . viewDidLoad . emit ( view ) ;
568
+ // fire off the "didLoad" lifecycle events
569
+ this . _willLoad ( view ) ;
570
+ this . _didLoad ( view ) ;
578
571
579
572
// render the component ref instance to the DOM
580
573
// ******** DOM WRITE ****************
581
574
viewport . insert ( componentRef . hostView , viewport . length ) ;
582
575
view . _state = ViewState . PRE_RENDERED ;
583
576
584
- // the ElementRef of the actual ion-page created
585
- const pageElement = componentRef . location . nativeElement ;
586
-
587
577
if ( view . _cssClass ) {
578
+ // the ElementRef of the actual ion-page created
579
+ var pageElement = componentRef . location . nativeElement ;
580
+
588
581
// ******** DOM WRITE ****************
589
582
this . _renderer . setElementClass ( pageElement , view . _cssClass , true ) ;
590
583
}
@@ -666,17 +659,8 @@ export class NavControllerBase extends Ion implements NavController {
666
659
667
660
_viewsWillLifecycles ( enteringView : ViewController , leavingView : ViewController ) {
668
661
// call each view's lifecycle events
669
- if ( enteringView ) {
670
- enteringView . _willEnter ( ) ;
671
- this . viewWillEnter . emit ( enteringView ) ;
672
- this . _app . viewWillEnter . emit ( enteringView ) ;
673
- }
674
-
675
- if ( leavingView ) {
676
- leavingView . _willLeave ( ) ;
677
- this . viewWillLeave . emit ( leavingView ) ;
678
- this . _app . viewWillLeave . emit ( leavingView ) ;
679
- }
662
+ enteringView && this . _willEnter ( enteringView ) ;
663
+ leavingView && this . _willLeave ( leavingView ) ;
680
664
}
681
665
682
666
_trnsFinish ( trns : Transition , opts : NavOptions , resolve : TransitionResolveFn ) {
@@ -690,16 +674,12 @@ export class NavControllerBase extends Ion implements NavController {
690
674
// transition has completed (went from 0 to 1)
691
675
if ( trns . enteringView ) {
692
676
enteringName = trns . enteringView . name ;
693
- trns . enteringView . _didEnter ( ) ;
694
- this . viewDidEnter . emit ( trns . enteringView ) ;
695
- this . _app . viewDidEnter . emit ( trns . enteringView ) ;
677
+ this . _didEnter ( trns . enteringView ) ;
696
678
}
697
679
698
680
if ( trns . leavingView ) {
699
681
leavingName = trns . leavingView . name ;
700
- trns . leavingView . _didLeave ( ) ;
701
- this . viewDidLeave . emit ( trns . leavingView ) ;
702
- this . _app . viewDidLeave . emit ( trns . leavingView ) ;
682
+ this . _didLeave ( trns . leavingView ) ;
703
683
}
704
684
705
685
this . _cleanup ( trns . enteringView ) ;
@@ -744,9 +724,7 @@ export class NavControllerBase extends Ion implements NavController {
744
724
if ( i > activeViewIndex ) {
745
725
// this view comes after the active view
746
726
// let's unload it
747
- view . _willUnload ( ) ;
748
- this . viewWillUnload . emit ( view ) ;
749
- this . _app . viewWillUnload . emit ( view ) ;
727
+ this . _willUnload ( view ) ;
750
728
view . _destroy ( this . _renderer ) ;
751
729
752
730
} else if ( i < activeViewIndex && ! this . _isPortal ) {
@@ -769,6 +747,47 @@ export class NavControllerBase extends Ion implements NavController {
769
747
}
770
748
}
771
749
750
+ _willLoad ( view : ViewController ) {
751
+ view . _willLoad ( ) ;
752
+ }
753
+
754
+ _didLoad ( view : ViewController ) {
755
+ view . _didLoad ( ) ;
756
+ this . viewDidLoad . emit ( view ) ;
757
+ this . _app . viewDidLoad . emit ( view ) ;
758
+ }
759
+
760
+ _willEnter ( view : ViewController ) {
761
+ view . _willEnter ( ) ;
762
+ this . viewWillEnter . emit ( view ) ;
763
+ this . _app . viewWillEnter . emit ( view ) ;
764
+ }
765
+
766
+ _didEnter ( view : ViewController ) {
767
+ view . _didEnter ( ) ;
768
+ this . viewDidEnter . emit ( view ) ;
769
+ this . _app . viewDidEnter . emit ( view ) ;
770
+ }
771
+
772
+ _willLeave ( view : ViewController ) {
773
+ view . _willLeave ( ) ;
774
+ this . viewWillLeave . emit ( view ) ;
775
+ this . _app . viewWillLeave . emit ( view ) ;
776
+ }
777
+
778
+ _didLeave ( view : ViewController ) {
779
+ view . _didLeave ( ) ;
780
+ this . viewDidLeave . emit ( view ) ;
781
+ this . _app . viewDidLeave . emit ( view ) ;
782
+ }
783
+
784
+ _willUnload ( view : ViewController ) {
785
+ view . _willUnload ( ) ;
786
+ this . viewWillUnload . emit ( view ) ;
787
+ this . _app . viewWillUnload . emit ( view ) ;
788
+ }
789
+
790
+
772
791
getActiveChildNav ( ) : any {
773
792
return this . _children [ this . _children . length - 1 ] ;
774
793
}
@@ -980,4 +999,4 @@ let ctrlIds = -1;
980
999
981
1000
const DISABLE_APP_MINIMUM_DURATION = 64 ;
982
1001
const ACTIVE_TRANSITION_MAX_TIME = 5000 ;
983
- const ACTIVE_TRANSITION_OFFSET = 400 ;
1002
+ const ACTIVE_TRANSITION_OFFSET = 2000 ;
0 commit comments