diff --git a/packages/core/ui/frame/fragment.transitions.android.ts b/packages/core/ui/frame/fragment.transitions.android.ts index 83fe2dd1a..cea73620d 100644 --- a/packages/core/ui/frame/fragment.transitions.android.ts +++ b/packages/core/ui/frame/fragment.transitions.android.ts @@ -143,13 +143,12 @@ export function _setAndroidFragmentTransitions(animated: boolean, navigationTran if (currentFragmentNeedsDifferentAnimation) { setupCurrentFragmentFadeTransition(navigationTransition, currentEntry); } - } else if (name === 'explode') { + } else if (name === 'explode') { setupNewFragmentExplodeTransition(navigationTransition, newEntry); if (currentFragmentNeedsDifferentAnimation) { setupCurrentFragmentExplodeTransition(navigationTransition, currentEntry); } } else if (name.indexOf('flip') === 0) { - navigationTransition = { duration: 3000, curve: null }; const direction = name.substr('flip'.length) || 'right'; //Extract the direction from the string const flipTransition = new FlipTransition(direction, navigationTransition.duration, navigationTransition.curve); diff --git a/packages/core/ui/frame/frame-common.ts b/packages/core/ui/frame/frame-common.ts index e89038db2..f8b98e87e 100644 --- a/packages/core/ui/frame/frame-common.ts +++ b/packages/core/ui/frame/frame-common.ts @@ -296,10 +296,6 @@ export class FrameBase extends CustomLayoutView { private raiseCurrentPageNavigatedEvents(isBack: boolean) { const page = this.currentPage; if (page) { - if (page.isLoaded) { - // Forward navigation does not remove page from frame so we raise unloaded manually. - page.callUnloaded(); - } page.onNavigatedFrom(isBack); } } diff --git a/packages/core/ui/frame/index.android.ts b/packages/core/ui/frame/index.android.ts index 91cd68408..40d1af199 100644 --- a/packages/core/ui/frame/index.android.ts +++ b/packages/core/ui/frame/index.android.ts @@ -324,6 +324,8 @@ export class Frame extends FrameBase { // If we had real navigation process queue. this._processNavigationQueue(entry.resolvedPage); + + } else { // Otherwise currentPage was recreated so this wasn't real navigation. // Continue with next item in the queue. @@ -436,7 +438,7 @@ export class Frame extends FrameBase { //transaction.setTransition(androidx.fragment.app.FragmentTransaction.TRANSIT_FRAGMENT_OPEN); } - transaction.replace(this.containerViewId, newFragment, newFragmentTag); + transaction.add(this.containerViewId, newFragment, newFragmentTag); transaction.commitAllowingStateLoss(); } @@ -458,8 +460,30 @@ export class Frame extends FrameBase { _reverseTransitions(backstackEntry, this._currentEntry); - transaction.replace(this.containerViewId, backstackEntry.fragment, backstackEntry.fragmentTag); - + const currentIndex =this.backStack.length; + const gotBackToIndex = this.backStack.indexOf(backstackEntry); + + for (let index = gotBackToIndex + 1; index < currentIndex; index++) { + transaction.remove(this.backStack[index].fragment); + } + if (this._currentEntry !== backstackEntry) { + // if we are going back we need to store where we are backing to + // so that we can set the current entry + if ((this._currentEntry as any).exitTransitionListener) { + (this._currentEntry as any).exitTransitionListener.backEntry = backstackEntry; + } + if ((this._currentEntry as any).returnTransitionListener) { + (this._currentEntry as any).returnTransitionListener.backEntry = backstackEntry; + } + if ((this._currentEntry as any).enterTransitionListener) { + (this._currentEntry as any).enterTransitionListener.backEntry = backstackEntry; + } + if ((this._currentEntry as any).reenterTransitionListener) { + (this._currentEntry as any).reenterTransitionListener.backEntry = backstackEntry; + } + transaction.remove((this._currentEntry).fragment); + + } transaction.commitAllowingStateLoss(); }