refactor: refactor

This commit is contained in:
Martin Yankov
2019-05-09 09:38:09 +03:00
parent 08fae2fb8e
commit f189152a4b
3 changed files with 5 additions and 16 deletions

View File

@@ -184,15 +184,6 @@ export function install() {
registerOnGlobalContext("Headers", "fetch"); registerOnGlobalContext("Headers", "fetch");
registerOnGlobalContext("Request", "fetch"); registerOnGlobalContext("Request", "fetch");
registerOnGlobalContext("Response", "fetch"); registerOnGlobalContext("Response", "fetch");
// check whether the 'android' namespace is exposed
// if positive - the current device is an Android
// so a custom implementation of the global 'console' object is attached.
// otherwise do nothing on iOS - the NS runtime provides a native 'console' functionality.
if ((<any>global).android) {
const consoleModule = require("console");
(<any>global).console = new consoleModule.Console();
}
} }
} }
install(); install();

View File

@@ -10,9 +10,8 @@ import {
} from "../styling/style-properties"; } from "../styling/style-properties";
import { layout } from "../../utils/utils"; import { layout } from "../../utils/utils";
import { device } from "../../platform"; import { device, screen } from "../../platform";
import lazy from "../../utils/lazy"; import lazy from "../../utils/lazy";
import * as platform from "../../platform";
export * from "./animation-common"; export * from "./animation-common";
interface AnimationDefinitionInternal extends AnimationDefinition { interface AnimationDefinitionInternal extends AnimationDefinition {
@@ -467,10 +466,10 @@ export class Animation extends AnimationBase {
throw new Error(`cannot animate ${propertyAnimation.property} on root view`); throw new Error(`cannot animate ${propertyAnimation.property} on root view`);
} }
const parentExtent: number = isVertical ? parent.getMeasuredHeight() : parent.getMeasuredWidth(); const parentExtent: number = isVertical ? parent.getMeasuredHeight() : parent.getMeasuredWidth();
toValue = PercentLength.toDevicePixels(toValue, parentExtent, parentExtent) / platform.screen.mainScreen.scale; toValue = PercentLength.toDevicePixels(toValue, parentExtent, parentExtent) / screen.mainScreen.scale;
const nativeHeight: number = isVertical ? nativeView.getHeight() : nativeView.getWidth(); const nativeHeight: number = isVertical ? nativeView.getHeight() : nativeView.getWidth();
const targetStyle: string = setLocal ? extentProperty.name : extentProperty.keyframe; const targetStyle: string = setLocal ? extentProperty.name : extentProperty.keyframe;
originalValue1 = nativeHeight / platform.screen.mainScreen.scale; originalValue1 = nativeHeight / screen.mainScreen.scale;
nativeArray[0] = originalValue1; nativeArray[0] = originalValue1;
nativeArray[1] = toValue; nativeArray[1] = toValue;
let extentAnimator = android.animation.ValueAnimator.ofFloat(nativeArray); let extentAnimator = android.animation.ValueAnimator.ofFloat(nativeArray);

View File

@@ -8,8 +8,7 @@ import {
heightProperty, widthProperty, PercentLength heightProperty, widthProperty, PercentLength
} from "../styling/style-properties"; } from "../styling/style-properties";
import { ios } from "../../utils/utils"; import { screen } from "../../platform";
import * as platform from "../../platform";
export * from "./animation-common"; export * from "./animation-common";
@@ -276,7 +275,7 @@ export class Animation extends AnimationBase {
let toValue = animation.value; let toValue = animation.value;
let fromValue; let fromValue;
const parent = animation.target.parent as View; const parent = animation.target.parent as View;
const screenScale: number = platform.screen.mainScreen.scale; const screenScale: number = screen.mainScreen.scale;
let tempRotate = (animation.target.rotate || 0) * Math.PI / 180; let tempRotate = (animation.target.rotate || 0) * Math.PI / 180;
let abs; let abs;