mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 03:31:45 +08:00
fix(android): disable animations for all in between fragments during a transition (#9772)
This prevent the wrong `transitionEnd` to be called last and thus the wrong `setCurrent` to be called on a released entry
This commit is contained in:
@ -426,7 +426,14 @@ export class Frame extends FrameBase {
|
|||||||
//TODO: Check whether or not this is still necessary. For Modal views?
|
//TODO: Check whether or not this is still necessary. For Modal views?
|
||||||
//transaction.setTransition(androidx.fragment.app.FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
|
//transaction.setTransition(androidx.fragment.app.FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
|
||||||
}
|
}
|
||||||
|
if (clearHistory || isReplace) {
|
||||||
|
// 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);
|
transaction.replace(this.containerViewId, newFragment, newFragmentTag);
|
||||||
transaction.commitAllowingStateLoss();
|
transaction.commitAllowingStateLoss();
|
||||||
}
|
}
|
||||||
@ -448,7 +455,14 @@ export class Frame extends FrameBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_reverseTransitions(backstackEntry, this._currentEntry);
|
_reverseTransitions(backstackEntry, this._currentEntry);
|
||||||
|
const currentIndex = this.backStack.length;
|
||||||
|
const goBackToIndex = this.backStack.indexOf(backstackEntry);
|
||||||
|
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.replace(this.containerViewId, backstackEntry.fragment, backstackEntry.fragmentTag);
|
transaction.replace(this.containerViewId, backstackEntry.fragment, backstackEntry.fragmentTag);
|
||||||
|
|
||||||
transaction.commitAllowingStateLoss();
|
transaction.commitAllowingStateLoss();
|
||||||
|
Reference in New Issue
Block a user