From 80fe1837ac1a4c4d239fa1221adbc0c855e04942 Mon Sep 17 00:00:00 2001 From: Martin Guillon Date: Thu, 10 Feb 2022 10:39:46 +0100 Subject: [PATCH] fix: disable animations for all in between fragments during a transition This prevent the wrong `transitionEnd` to be called last and thus the wrong `setCurrent` to be called on a released entry --- packages/core/ui/frame/index.android.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/core/ui/frame/index.android.ts b/packages/core/ui/frame/index.android.ts index 2ab8b3d55..55af28052 100644 --- a/packages/core/ui/frame/index.android.ts +++ b/packages/core/ui/frame/index.android.ts @@ -440,7 +440,13 @@ export class Frame extends FrameBase { } if (clearHistory || isReplace) { - transaction.replace(this.containerViewId, newFragment, newFragmentTag); + // we need to ensure we dont listen for animations of + // in between fragments or they could break our transition end handling + // and set the wrong current entry + for (let index = 0; index < this.backStack.length; index++) { + _clearEntry(this.backStack[index]); + } + transaction.replace(this.containerViewId, newFragment, newFragmentTag); } else { transaction.add(this.containerViewId, newFragment, newFragmentTag); } @@ -473,6 +479,10 @@ export class Frame extends FrameBase { // the order is important so that the last transition listener called be // the one from the current entry we are going back from for (let index = goBackToIndex + 1; index < currentIndex; index++) { + // we need to ensure we dont listen for animations of + // in between fragments or they could break our transition end handling + // and set the wrong current entry + _clearEntry(this.backStack[index]); transaction.remove(this.backStack[index].fragment); } if (this._currentEntry !== backstackEntry) {