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

Fixed a visual glitch with manual iOS transitions by hamorphis · Pull Request #2286 · NativeScript/NativeScript · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .ts  (3) 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
6 changes: 5 additions & 1 deletion tns-core-modules/ui/frame/frame.ios.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 @@ -77,6 +77,10 @@ export class Frame extends frameCommon.Frame {
throw new Error("Required page does not have a viewController created.");
}

let clearHistory = backstackEntry.entry.clearHistory;
if (clearHistory) {
navDepth = -1;
}
navDepth++;

let navigationTransition: definition.NavigationTransition;
Expand Down Expand Up @@ -117,7 +121,7 @@ export class Frame extends frameCommon.Frame {
}

// We should clear the entire history.
if (backstackEntry.entry.clearHistory) {
if (clearHistory) {
viewController.navigationItem.hidesBackButton = true;
var newControllers = NSMutableArray.alloc().initWithCapacity(1);
newControllers.addObject(viewController);
Expand Down
13 changes: 10 additions & 3 deletions tns-core-modules/ui/transition/fade-transition.ios.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 @@ -2,6 +2,9 @@

export class FadeTransition extends transition.Transition {
public animateIOSTransition(containerView: UIView, fromView: UIView, toView: UIView, operation: UINavigationControllerOperation, completion: (finished: boolean) => void): void {
let originalToViewAlpha = toView.alpha;
let originalFromViewAlpha = fromView.alpha;

toView.alpha = 0.0;
fromView.alpha = 1.0;

Expand All @@ -14,12 +17,16 @@ export class FadeTransition extends transition.Transition {
break;
}

var duration = this.getDuration();
var curve = this.getCurve();
let duration = this.getDuration();
let curve = this.getCurve();
UIView.animateWithDurationAnimationsCompletion(duration, () => {
UIView.setAnimationCurve(curve);
toView.alpha = 1.0;
fromView.alpha = 0.0;
}, completion);
}, (finished: boolean) => {
toView.alpha = originalToViewAlpha;
fromView.alpha = originalFromViewAlpha;
completion(finished);
});
}
}
31 changes: 19 additions & 12 deletions tns-core-modules/ui/transition/slide-transition.ios.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
@@ -1,12 +1,12 @@
import transition = require("ui/transition");
import platform = require("platform");

var screenWidth = platform.screen.mainScreen.widthDIPs;
var screenHeight = platform.screen.mainScreen.heightDIPs;
var leftEdge = CGAffineTransformMakeTranslation(-screenWidth, 0);
var rightEdge = CGAffineTransformMakeTranslation(screenWidth, 0);
var topEdge = CGAffineTransformMakeTranslation(0, -screenHeight);
var bottomEdge = CGAffineTransformMakeTranslation(0, screenHeight);
let screenWidth = platform.screen.mainScreen.widthDIPs;
let screenHeight = platform.screen.mainScreen.heightDIPs;
let leftEdge = CGAffineTransformMakeTranslation(-screenWidth, 0);
let rightEdge = CGAffineTransformMakeTranslation(screenWidth, 0);
let topEdge = CGAffineTransformMakeTranslation(0, -screenHeight);
let bottomEdge = CGAffineTransformMakeTranslation(0, screenHeight);

export class SlideTransition extends transition.Transition {
private _direction: string;
Expand All @@ -17,9 +17,12 @@ export class SlideTransition extends transition.Transition {
}

public animateIOSTransition(containerView: UIView, fromView: UIView, toView: UIView, operation: UINavigationControllerOperation, completion: (finished: boolean) => void): void {
var fromViewEndTransform: CGAffineTransform;
var toViewBeginTransform: CGAffineTransform;
var push = (operation === UINavigationControllerOperation.UINavigationControllerOperationPush);
let originalToViewTransform = toView.transform;
let originalFromViewTransform = fromView.transform;

let fromViewEndTransform: CGAffineTransform;
let toViewBeginTransform: CGAffineTransform;
let push = (operation === UINavigationControllerOperation.UINavigationControllerOperationPush);

switch (this._direction) {
case "left":
Expand Down Expand Up @@ -52,12 +55,16 @@ export class SlideTransition extends transition.Transition {
break;
}

var duration = this.getDuration();
var curve = this.getCurve();
let duration = this.getDuration();
let curve = this.getCurve();
UIView.animateWithDurationAnimationsCompletion(duration, () => {
UIView.setAnimationCurve(curve);
toView.transform = CGAffineTransformIdentity;
fromView.transform = fromViewEndTransform;
}, completion);
}, (finished: boolean) => {
toView.transform = originalToViewTransform;
fromView.transform = originalFromViewTransform;
completion(finished);
});
}
}

Back | FazBrowse Home | New Git URL