FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(android): back navigation on app suspend/resume by manoldonev · Pull Request #6489 · NativeScript/NativeScript · GitHub

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .ts  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
31 changes: 21 additions & 10 deletions tns-core-modules/ui/frame/frame.android.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ import { createViewFromEntry } from "../builder";
export * from "./frame-common";

interface AnimatorState {
enterAnimator: android.animation.Animator;
exitAnimator: android.animation.Animator;
popEnterAnimator: android.animation.Animator;
popExitAnimator: android.animation.Animator;
enterAnimator: any;
exitAnimator: any;
popEnterAnimator: any;
popExitAnimator: any;
transitionName: string;
}

Expand Down Expand Up @@ -306,10 +306,8 @@ export class Frame extends FrameBase {
// restore cached animation settings if we just completed simulated first navigation (no animation)
if (this._cachedAnimatorState) {
restoreAnimatorState(this._currentEntry, this._cachedAnimatorState);

this._cachedAnimatorState = null;
}

}

public onBackPressed(): boolean {
Expand Down Expand Up @@ -503,13 +501,26 @@ export class Frame extends FrameBase {
}
}

function cloneExpandedAnimator(expandedAnimator: any) {
if (!expandedAnimator) {
return null;
}

const clone = expandedAnimator.clone();
clone.entry = expandedAnimator.entry;
clone.transitionType = expandedAnimator.transitionType;

return clone;
}

function getAnimatorState(entry: BackstackEntry): AnimatorState {
const expandedEntry = <any>entry;
const animatorState = <AnimatorState>{};
animatorState.enterAnimator = expandedEntry.enterAnimator;
animatorState.exitAnimator = expandedEntry.exitAnimator;
animatorState.popEnterAnimator = expandedEntry.popEnterAnimator;
animatorState.popExitAnimator = expandedEntry.popExitAnimator;

animatorState.enterAnimator = cloneExpandedAnimator(expandedEntry.enterAnimator);
animatorState.exitAnimator = cloneExpandedAnimator(expandedEntry.exitAnimator);
animatorState.popEnterAnimator = cloneExpandedAnimator(expandedEntry.popEnterAnimator);
animatorState.popExitAnimator = cloneExpandedAnimator(expandedEntry.popExitAnimator);
animatorState.transitionName = expandedEntry.transitionName;

return animatorState;
Expand Down

Back | FazBrowse Home | New Git URL