mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-19 06:10:56 +08:00
chore: cleanup fragment handling for 1.3+ in addition to older
This commit is contained in:
@ -95,6 +95,15 @@ export function _setAndroidFragmentTransitions(animated: boolean, navigationTran
|
||||
if (name === 'none') {
|
||||
const noTransition = new NoTransition(0, null);
|
||||
|
||||
if ((<any>androidx.fragment.app.FragmentManager).enableNewStateManager) {
|
||||
// androidx.fragment 1.3.0+
|
||||
if (isNestedDefaultTransition) {
|
||||
setTimeout(() => {
|
||||
addToWaitingQueue(newEntry);
|
||||
transitionOrAnimationCompleted(newEntry, null);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// Setup empty/immediate animator when transitioning to nested frame for first time.
|
||||
// Also setup empty/immediate transition to be executed when navigating back to this page.
|
||||
// TODO: Consider removing empty/immediate animator when migrating to official androidx.fragment.app.Fragment:1.2.
|
||||
@ -105,6 +114,7 @@ export function _setAndroidFragmentTransitions(animated: boolean, navigationTran
|
||||
} else {
|
||||
setupNewFragmentCustomTransition({ duration: 0, curve: null }, newEntry, noTransition);
|
||||
}
|
||||
}
|
||||
|
||||
newEntry.isNestedDefaultTransition = isNestedDefaultTransition;
|
||||
|
||||
@ -669,7 +679,7 @@ function transitionOrAnimationCompleted(entry: ExpandedEntry, backEntry: Backsta
|
||||
entries.delete(entry);
|
||||
if (entries.size === 0) {
|
||||
const frame = entry.resolvedPage.frame;
|
||||
|
||||
if (frame) {
|
||||
// We have 0 or 1 entry per frameId in completedEntries
|
||||
// So there is no need to make it to Set like waitingQueue
|
||||
const previousCompletedAnimationEntry = completedEntries.get(frameId);
|
||||
@ -686,6 +696,7 @@ function transitionOrAnimationCompleted(entry: ExpandedEntry, backEntry: Backsta
|
||||
if (current) {
|
||||
setTimeout(() => frame.setCurrent(backEntry || current, navigationContext.navigationType));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
completedEntries.set(frameId, entry);
|
||||
}
|
||||
|
Reference in New Issue
Block a user