Files
NativeScript/tns-core-modules/ui/transition/fade-transition.ios.ts
Panayot Cankov 1236f66f44 Add npm script that generates ios .d.ts-es from the tests app
Less than 30 erros left, let's hope it still works

Added lib.*.d.ts from typescript, removed lib and dom stuff, added by hand XHR, alert etc. .d.ts-es for polyfills

Roll back some changes involved in separating UIEvent for dom and ios

Test combined dts-es will now use lib, while internally we will not to avoid UIEvent conflict with dom stuff
2016-08-29 09:58:17 +03:00

32 lines
1.2 KiB
TypeScript

import transition = require("ui/transition");
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;
switch (operation) {
case UINavigationControllerOperation.Push:
containerView.insertSubviewAboveSubview(toView, fromView);
break;
case UINavigationControllerOperation.Pop:
containerView.insertSubviewBelowSubview(toView, fromView);
break;
}
let duration = this.getDuration();
let curve = this.getCurve();
UIView.animateWithDurationAnimationsCompletion(duration, () => {
UIView.setAnimationCurve(curve);
toView.alpha = 1.0;
fromView.alpha = 0.0;
}, (finished: boolean) => {
toView.alpha = originalToViewAlpha;
fromView.alpha = originalFromViewAlpha;
completion(finished);
});
}
}