Add isIOS, isAndroid in platform, and fast ts watcher and transpiler

Image should not requestLayout when sized with 'exactly' spec

Update image tests

Tests will run in ios only
This commit is contained in:
Panayot Cankov
2016-05-27 14:49:22 +03:00
parent 44abf94add
commit 717b5131b1
9 changed files with 272 additions and 41 deletions

View File

@@ -133,3 +133,5 @@ export var device: definition.Device = new Device();
export module screen {
export var mainScreen = new MainScreen();
}
export var isAndroid = true;

View File

@@ -3,6 +3,16 @@
* Contains all kinds of information about the device, its operating system and software.
*/
declare module "platform" {
/**
* Gets a value indicating if the app is running on the Android platform.
*/
export var isAndroid: boolean;
/**
* Gets a value indicating if the app is running on the iOS platform.
*/
export var isIOS: boolean;
/*
* Enum holding platform names.

View File

@@ -126,3 +126,5 @@ export var device: definition.Device = new Device();
export module screen {
export var mainScreen = new MainScreen();
}
export var isIOS = true;

View File

@@ -36,6 +36,7 @@ function onImageSourcePropertyChanged(data: dependencyObservable.PropertyChangeD
export class Image extends imageCommon.Image {
private _ios: UIImageView;
private _imageSourceAffectsLayout: boolean = true;
constructor() {
super();
@@ -54,7 +55,7 @@ export class Image extends imageCommon.Image {
public _setNativeImage(nativeImage: any) {
this.ios.image = nativeImage;
if (isNaN(this.width) || isNaN(this.height)) {
if (this._imageSourceAffectsLayout) {
this.requestLayout();
}
}
@@ -77,7 +78,9 @@ export class Image extends imageCommon.Image {
var finiteWidth: boolean = widthMode !== utils.layout.UNSPECIFIED;
var finiteHeight: boolean = heightMode !== utils.layout.UNSPECIFIED;
this._imageSourceAffectsLayout = widthMode !== utils.layout.EXACTLY || heightMode !== utils.layout.EXACTLY;
if (nativeWidth !== 0 && nativeHeight !== 0 && (finiteWidth || finiteHeight)) {
var scale = Image.computeScaleFactor(width, height, finiteWidth, finiteHeight, nativeWidth, nativeHeight, this.stretch);
var resultW = Math.floor(nativeWidth * scale.width);