mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-20 23:42:50 +08:00
dont use replace transaction anymore.
That way we dont “unload” and “load” fragments. This fixes black screens and slow transitions with opengl or cameras # Conflicts: # packages/core/ui/frame/fragment.transitions.android.ts # packages/core/ui/frame/frame-common.ts # packages/core/ui/frame/index.android.ts
This commit is contained in:
@ -149,7 +149,6 @@ export function _setAndroidFragmentTransitions(animated: boolean, navigationTran
|
|||||||
setupCurrentFragmentExplodeTransition(navigationTransition, currentEntry);
|
setupCurrentFragmentExplodeTransition(navigationTransition, currentEntry);
|
||||||
}
|
}
|
||||||
} else if (name.indexOf('flip') === 0) {
|
} 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 direction = name.substr('flip'.length) || 'right'; //Extract the direction from the string
|
||||||
const flipTransition = new FlipTransition(direction, navigationTransition.duration, navigationTransition.curve);
|
const flipTransition = new FlipTransition(direction, navigationTransition.duration, navigationTransition.curve);
|
||||||
|
|
||||||
|
@ -296,10 +296,6 @@ export class FrameBase extends CustomLayoutView {
|
|||||||
private raiseCurrentPageNavigatedEvents(isBack: boolean) {
|
private raiseCurrentPageNavigatedEvents(isBack: boolean) {
|
||||||
const page = this.currentPage;
|
const page = this.currentPage;
|
||||||
if (page) {
|
if (page) {
|
||||||
if (page.isLoaded) {
|
|
||||||
// Forward navigation does not remove page from frame so we raise unloaded manually.
|
|
||||||
page.callUnloaded();
|
|
||||||
}
|
|
||||||
page.onNavigatedFrom(isBack);
|
page.onNavigatedFrom(isBack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -324,6 +324,8 @@ export class Frame extends FrameBase {
|
|||||||
|
|
||||||
// If we had real navigation process queue.
|
// If we had real navigation process queue.
|
||||||
this._processNavigationQueue(entry.resolvedPage);
|
this._processNavigationQueue(entry.resolvedPage);
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Otherwise currentPage was recreated so this wasn't real navigation.
|
// Otherwise currentPage was recreated so this wasn't real navigation.
|
||||||
// Continue with next item in the queue.
|
// 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.setTransition(androidx.fragment.app.FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
transaction.replace(this.containerViewId, newFragment, newFragmentTag);
|
transaction.add(this.containerViewId, newFragment, newFragmentTag);
|
||||||
transaction.commitAllowingStateLoss();
|
transaction.commitAllowingStateLoss();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -458,8 +460,30 @@ export class Frame extends FrameBase {
|
|||||||
|
|
||||||
_reverseTransitions(backstackEntry, this._currentEntry);
|
_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();
|
transaction.commitAllowingStateLoss();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user