android fragment transitions fully working now

This commit is contained in:
Martin Guillon
2020-08-27 09:07:25 +02:00
parent be15327dcc
commit 5fcfb75350
2 changed files with 7 additions and 3 deletions

View File

@ -259,8 +259,8 @@ export class FrameBase extends CustomLayoutView {
public _updateBackstack(entry: BackstackEntry, navigationType: NavigationType): void {
const isBack = navigationType === NavigationType.back;
const isReplace = navigationType === NavigationType.replace;
this.raiseCurrentPageNavigatedEvents(isBack);
const current = this._currentEntry;
this.raiseCurrentPageNavigatedEvents(isBack);
// Do nothing for Hot Module Replacement
if (isBack) {

View File

@ -444,6 +444,9 @@ export class Frame extends FrameBase {
} else {
transaction.add(this.containerViewId, newFragment, newFragmentTag);
}
if (this._currentEntry && this._currentEntry.entry.backstackVisible === false) {
transaction.remove(this._currentEntry.fragment);
}
transaction.commitAllowingStateLoss();
}
@ -466,7 +469,7 @@ export class Frame extends FrameBase {
_reverseTransitions(backstackEntry, this._currentEntry);
const currentIndex =this.backStack.length;
const gotBackToIndex = this.backStack.indexOf(backstackEntry);
const goBackToIndex = this.backStack.indexOf(backstackEntry);
// the order is important so that the transition listener called be
// the one from the current entry we are going back from
@ -481,9 +484,10 @@ export class Frame extends FrameBase {
transaction.remove((this._currentEntry).fragment);
}
for (let index = gotBackToIndex + 1; index < currentIndex; index++) {
for (let index = goBackToIndex + 1; index < currentIndex; index++) {
transaction.remove(this.backStack[index].fragment);
}
transaction.commitAllowingStateLoss();
}