@@ -11,7 +11,7 @@ import { Trace } from '../../trace';
11
11
import { View } from '../core/view' ;
12
12
import { _stack , FrameBase , NavigationType } from './frame-common' ;
13
13
14
- import { _clearEntry , _clearFragment , _getAnimatedEntries , _reverseTransitions , _setAndroidFragmentTransitions , _updateTransitions , addNativeTransitionListener } from './fragment.transitions' ;
14
+ import { _clearEntry , _clearFragment , _getAnimatedEntries , _getTransitionState , _restoreTransitionState , _reverseTransitions , _setAndroidFragmentTransitions , _unsetTransitionProperties , _updateTransitions , addNativeTransitionListener } from './fragment.transitions' ;
15
15
16
16
import { profile } from '../../profiling' ;
17
17
import { android as androidUtils } from '../../utils/native-helper' ;
@@ -194,7 +194,7 @@ export class Frame extends FrameBase {
194
194
// simulated navigation (NoTransition, zero duration animator) and thus the fragment immediately disappears;
195
195
// the user only sees the animation of the entering fragment as per its specific enter animation settings.
196
196
// NOTE: we are restoring the animation settings in Frame.setCurrent(...) as navigation completes asynchronously
197
- const cachedTransitionState = getTransitionState ( this . _currentEntry ) ;
197
+ const cachedTransitionState = _getTransitionState ( this . _currentEntry ) ;
198
198
199
199
if ( cachedTransitionState ) {
200
200
this . _cachedTransitionState = cachedTransitionState ;
@@ -359,7 +359,7 @@ export class Frame extends FrameBase {
359
359
360
360
// restore cached animation settings if we just completed simulated first navigation (no animation)
361
361
if ( this . _cachedTransitionState ) {
362
- restoreTransitionState ( this . _currentEntry , this . _cachedTransitionState ) ;
362
+ _restoreTransitionState ( this . _currentEntry , this . _cachedTransitionState ) ;
363
363
this . _cachedTransitionState = null ;
364
364
}
365
365
@@ -398,7 +398,7 @@ export class Frame extends FrameBase {
398
398
// HACK: This @profile decorator creates a circular dependency
399
399
// HACK: because the function parameter type is evaluated with 'typeof'
400
400
@profile
401
- public _navigateCore ( newEntry : any ) {
401
+ public _navigateCore ( newEntry : BackstackEntry ) {
402
402
// should be (newEntry: BackstackEntry)
403
403
super . _navigateCore ( newEntry ) ;
404
404
@@ -495,6 +495,7 @@ export class Frame extends FrameBase {
495
495
if ( removed . fragment ) {
496
496
_clearEntry ( removed ) ;
497
497
}
498
+ _unsetTransitionProperties ( removed ) ;
498
499
499
500
removed . fragment = null ;
500
501
removed . viewSavedState = null ;
@@ -504,6 +505,7 @@ export class Frame extends FrameBase {
504
505
if ( entry . fragment ) {
505
506
_clearFragment ( entry ) ;
506
507
}
508
+ _unsetTransitionProperties ( entry ) ;
507
509
508
510
entry . recreated = false ;
509
511
entry . fragment = null ;
@@ -616,58 +618,6 @@ export function reloadPage(context?: ModuleContext): void {
616
618
// attach on global, so it can be overwritten in NativeScript Angular
617
619
global . __onLiveSyncCore = Frame . reloadPage ;
618
620
619
- function cloneExpandedTransitionListener ( expandedTransitionListener : any ) {
620
- if ( ! expandedTransitionListener ) {
621
- return null ;
622
- }
623
-
624
- const cloneTransition = expandedTransitionListener . transition . clone ( ) ;
625
-
626
- return addNativeTransitionListener ( expandedTransitionListener . entry , cloneTransition ) ;
627
- }
628
-
629
- function getTransitionState ( entry : BackstackEntry ) : TransitionState {
630
- const expandedEntry = < any > entry ;
631
-
632
- let transitionState : TransitionState ;
633
-
634
- if ( expandedEntry . enterTransitionListener && expandedEntry . exitTransitionListener ) {
635
- transitionState = < TransitionState > { } ;
636
-
637
- transitionState . enterTransitionListener = cloneExpandedTransitionListener ( expandedEntry . enterTransitionListener ) ;
638
- transitionState . exitTransitionListener = cloneExpandedTransitionListener ( expandedEntry . exitTransitionListener ) ;
639
- transitionState . reenterTransitionListener = cloneExpandedTransitionListener ( expandedEntry . reenterTransitionListener ) ;
640
- transitionState . returnTransitionListener = cloneExpandedTransitionListener ( expandedEntry . returnTransitionListener ) ;
641
- transitionState . transitionName = expandedEntry . transitionName ;
642
- transitionState . entry = entry ;
643
- } else {
644
- transitionState = null ;
645
- }
646
-
647
- return transitionState ;
648
- }
649
-
650
- function restoreTransitionState ( entry : BackstackEntry , snapshot : TransitionState ) : void {
651
- const expandedEntry = < any > entry ;
652
- if ( snapshot . enterTransitionListener ) {
653
- expandedEntry . enterTransitionListener = snapshot . enterTransitionListener ;
654
- }
655
-
656
- if ( snapshot . exitTransitionListener ) {
657
- expandedEntry . exitTransitionListener = snapshot . exitTransitionListener ;
658
- }
659
-
660
- if ( snapshot . reenterTransitionListener ) {
661
- expandedEntry . reenterTransitionListener = snapshot . reenterTransitionListener ;
662
- }
663
-
664
- if ( snapshot . returnTransitionListener ) {
665
- expandedEntry . returnTransitionListener = snapshot . returnTransitionListener ;
666
- }
667
-
668
- expandedEntry . transitionName = snapshot . transitionName ;
669
- }
670
-
671
621
let framesCounter = 0 ;
672
622
const framesCache = new Array < WeakRef < AndroidFrame > > ( ) ;
673
623
0 commit comments