Skip to content

Commit d10ca1d

Browse files
committed
Fix the last several errors
1 parent 6122c44 commit d10ca1d

File tree

26 files changed

+147
-158
lines changed

26 files changed

+147
-158
lines changed

apps/app/ui-tests-app/layouts-percent/grid.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ export function onLoaded(args: { eventName: string, object: any }) {
99
}
1010

1111
export function onAddRowColumn(args: { eventName: string, object: any }) {
12+
1213
var layout = <GridLayout>args.object.parent.parent;
1314
var row = new ItemSpec(1, GridUnitType.AUTO);
1415
var column = new ItemSpec(1, GridUnitType.AUTO);
16+
1517
layout.addRow(row);
1618
layout.addColumn(column);
1719

apps/app/ui-tests-app/layouts-percent/myview.ts

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { LayoutBase, View, Observable, HorizontalAlignment, VerticalAlignment, Visibility} from "ui/layouts/layout-base";
1+
import { LayoutBase, View, Observable, HorizontalAlignment, VerticalAlignment, Visibility} from "ui/layouts/layout-base";
22

33
export class ViewModel extends Observable {
44

@@ -42,32 +42,34 @@ export class ViewModel extends Observable {
4242

4343
public onAlignments(args: { eventName: string, object: any }): void {
4444
var view: View = <View>args.object;
45-
if (view.horizontalAlignment === HorizontalAlignment.STRETCH) {
46-
view.horizontalAlignment = HorizontalAlignment.LEFT;
47-
view.verticalAlignment = VerticalAlignment.TOP;
48-
} else if (view.horizontalAlignment === HorizontalAlignment.LEFT) {
49-
view.horizontalAlignment = HorizontalAlignment.CENTER;
50-
view.verticalAlignment = VerticalAlignment.MIDDLE;
51-
} else if (view.horizontalAlignment === HorizontalAlignment.CENTER) {
52-
view.horizontalAlignment = HorizontalAlignment.RIGHT;
53-
view.verticalAlignment = VerticalAlignment.BOTTOM;
45+
46+
if (view.horizontalAlignment === "stretch") {
47+
view.horizontalAlignment = "left";
48+
view.verticalAlignment = "top";
49+
} else if (view.horizontalAlignment === "left") {
50+
view.horizontalAlignment = "center";
51+
view.verticalAlignment = "middle";
52+
} else if (view.horizontalAlignment === "center") {
53+
view.horizontalAlignment = "right";
54+
view.verticalAlignment = "bottom";
5455
} else {
55-
view.horizontalAlignment = HorizontalAlignment.STRETCH;
56-
view.verticalAlignment = VerticalAlignment.STRETCH;
56+
view.horizontalAlignment = "stretch";
57+
view.verticalAlignment = "stretch";
5758
}
5859
}
5960

6061
public onCollapse(args: { eventName: string, object: any }): void {
6162
var view: View = <View>args.object;
62-
view.visibility = Visibility.COLLAPSE;
63+
view.visibility = "collapse";
6364
}
6465

6566
public onVisibile(args: { eventName: string, object: any }): void {
6667
var view: View = <View>args.object;
68+
6769
var layout = <LayoutBase>view.parent;
6870

69-
var child = <View>layout.getViewById("collapse");
70-
child.visibility = Visibility.VISIBLE;
71+
var child = layout.getViewById<View>("collapse");
72+
child.visibility = "visible";
7173
}
7274

7375
// Layout properties

apps/app/ui-tests-app/layouts/grid.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ export function onLoaded(args: { eventName: string, object: any }) {
99
}
1010

1111
export function onAddRowColumn(args: { eventName: string, object: any }) {
12+
1213
var layout = <GridLayout>args.object.parent.parent;
13-
var row = new ItemSpec(1, GridUnitType.AUTO);
14-
var column = new ItemSpec(1, GridUnitType.AUTO);
14+
var row = new ItemSpec(1, "auto");
15+
var column = new ItemSpec(1, "auto");
16+
1517
layout.addRow(row);
1618
layout.addColumn(column);
1719

apps/app/ui-tests-app/layouts/myview.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,32 +42,32 @@ export class ViewModel extends Observable {
4242

4343
public onAlignments(args: { eventName: string, object: any }): void {
4444
var view: View = <View>args.object;
45-
if (view.horizontalAlignment === HorizontalAlignment.STRETCH) {
46-
view.horizontalAlignment = HorizontalAlignment.LEFT;
47-
view.verticalAlignment = VerticalAlignment.TOP;
48-
} else if (view.horizontalAlignment === HorizontalAlignment.LEFT) {
49-
view.horizontalAlignment = HorizontalAlignment.CENTER;
50-
view.verticalAlignment = VerticalAlignment.MIDDLE;
51-
} else if (view.horizontalAlignment === HorizontalAlignment.CENTER) {
52-
view.horizontalAlignment = HorizontalAlignment.RIGHT;
53-
view.verticalAlignment = VerticalAlignment.BOTTOM;
45+
if (view.horizontalAlignment === "stretch") {
46+
view.horizontalAlignment = "left";
47+
view.verticalAlignment = "top";
48+
} else if (view.horizontalAlignment === "left") {
49+
view.horizontalAlignment = "center";
50+
view.verticalAlignment = "middle";
51+
} else if (view.horizontalAlignment === "center") {
52+
view.horizontalAlignment = "right";
53+
view.verticalAlignment = "bottom";
5454
} else {
55-
view.horizontalAlignment = HorizontalAlignment.STRETCH;
56-
view.verticalAlignment = VerticalAlignment.STRETCH;
55+
view.horizontalAlignment = "stretch";
56+
view.verticalAlignment = "stretch";
5757
}
5858
}
5959

6060
public onCollapse(args: { eventName: string, object: any }): void {
6161
var view: View = <View>args.object;
62-
view.visibility = Visibility.COLLAPSE;
62+
view.visibility = "collapse";
6363
}
6464

6565
public onVisibile(args: { eventName: string, object: any }): void {
6666
var view: View = <View>args.object;
6767
var layout = <LayoutBase>view.parent;
6868

6969
var child = <View>layout.getViewById("collapse");
70-
child.visibility = Visibility.VISIBLE;
70+
child.visibility = "visible";
7171
}
7272

7373
// Layout properties

apps/app/ui-tests-app/pages/pan-event.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { TextView } from "ui/text-view";
77
var view: View;
88
export function navigatingTo(args: EventData) {
99
var page = <Page>args.object;
10-
view = <View>page.getViewById("target");
10+
view = page.getViewById<View>("target");
1111
}
1212

1313
export function onPan(data: PanGestureEventData) {

apps/app/ui-tests-app/tab-view/tab-view-icon.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ let iconModes = ["automatic", "alwaysOriginal", "alwaysTemplate", undefined];
77
export function onChangeRenderingMode(args: EventData){
88
let button = (<Button>args.object);
99
let tabView = button.page.getViewById<TabView>("tab-view");
10+
1011
tabView.iosIconRenderingMode = <"automatic" | "alwaysOriginal" | "alwaysTemplate">iconModes[(iconModes.indexOf(tabView.iosIconRenderingMode) + 1) % iconModes.length];
12+
1113
for(let i = 0, length = tabView.items.length; i < length; i++){
1214
(<Button>tabView.items[i].view).text = "" + tabView.iosIconRenderingMode;
1315
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"time-grunt": "1.3.0",
3232
"tslint": "^3.15.1",
3333
"typedoc": "0.4.5",
34-
"typescript": "~2.0.10"
34+
"typescript": "^2.0.10"
3535
},
3636
"scripts": {
3737
"setup": "npm run dev-link-tns-platform-declarations && npm run dev-link-tns-core-modules && npm run dev-link-tests && npm run dev-link-apps",

tests/app/app/style_props.ts

Lines changed: 37 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as style from "ui/styling/style";
22
import {PropertyMetadata, PropertyMetadataSettings} from "ui/core/dependency-observable";
3-
import * as styleProperty from "ui/styling/style-property";
43
import * as view from "ui/core/view";
54
import * as buttonModule from "ui/button";
65
import * as pages from "ui/page";
@@ -10,46 +9,46 @@ import {isAndroid} from "platform";
109
// on Android we explicitly set propertySettings to None because android will invalidate its layout (skip unnecessary native call).
1110
let AffectsLayout = isAndroid ? PropertyMetadataSettings.None : PropertyMetadataSettings.AffectsLayout;
1211

13-
export var fontFamilyProperty = new styleProperty.Property("fontFamily", "font-family", new PropertyMetadata(undefined, AffectsLayout));
12+
// export var fontFamilyProperty = new styleProperty.Property("fontFamily", "font-family", new PropertyMetadata(undefined, AffectsLayout));
1413

15-
export class MyTextViewStyler implements style.Styler {
16-
public static setFontFamilyProperty(view: view.View, newValue: any) {
17-
if (view.android) {
18-
(<android.widget.TextView>view.android).setTypeface(android.graphics.Typeface.create(newValue, android.graphics.Typeface.NORMAL));
19-
}
20-
else if (view.ios) {
21-
var fontSize = (<UIButton>view._nativeView).titleLabel.font.pointSize;
22-
(<UIButton>view._nativeView).titleLabel.font = UIFont.fontWithNameSize(newValue, fontSize);
23-
}
24-
}
14+
// export class MyTextViewStyler implements style.Styler {
15+
// public static setFontFamilyProperty(view: view.View, newValue: any) {
16+
// if (view.android) {
17+
// (<android.widget.TextView>view.android).setTypeface(android.graphics.Typeface.create(newValue, android.graphics.Typeface.NORMAL));
18+
// }
19+
// else if (view.ios) {
20+
// var fontSize = (<UIButton>view._nativeView).titleLabel.font.pointSize;
21+
// (<UIButton>view._nativeView).titleLabel.font = UIFont.fontWithNameSize(newValue, fontSize);
22+
// }
23+
// }
2524

26-
public static resetFontFamilyProperty(view: view.View, nativeValue: any) {
27-
if (view.android) {
28-
(<android.widget.TextView>view.android).setTypeface(android.graphics.Typeface.create(nativeValue, android.graphics.Typeface.NORMAL));
29-
}
30-
else if (view.ios) {
31-
var fontSize = (<UIButton>view._nativeView).titleLabel.font.pointSize;
32-
(<UIButton>view._nativeView).titleLabel.font = UIFont.fontWithNameSize(nativeValue, fontSize);;
33-
}
34-
}
25+
// public static resetFontFamilyProperty(view: view.View, nativeValue: any) {
26+
// if (view.android) {
27+
// (<android.widget.TextView>view.android).setTypeface(android.graphics.Typeface.create(nativeValue, android.graphics.Typeface.NORMAL));
28+
// }
29+
// else if (view.ios) {
30+
// var fontSize = (<UIButton>view._nativeView).titleLabel.font.pointSize;
31+
// (<UIButton>view._nativeView).titleLabel.font = UIFont.fontWithNameSize(nativeValue, fontSize);;
32+
// }
33+
// }
3534

36-
public static getNativeFontFamilyValue = function (view: view.View): any {
37-
if (view.android) {
38-
return (<android.widget.TextView>view.android).getTypeface();
39-
}
40-
else if (view.ios) {
41-
return (<UIButton>view._nativeView).titleLabel.font.fontName;
42-
}
43-
return null;
44-
}
35+
// public static getNativeFontFamilyValue = function (view: view.View): any {
36+
// if (view.android) {
37+
// return (<android.widget.TextView>view.android).getTypeface();
38+
// }
39+
// else if (view.ios) {
40+
// return (<UIButton>view._nativeView).titleLabel.font.fontName;
41+
// }
42+
// return null;
43+
// }
4544

46-
public static registerHandlers() {
47-
style.registerHandler(fontFamilyProperty, new style.StylePropertyChangedHandler(
48-
MyTextViewStyler.setFontFamilyProperty,
49-
MyTextViewStyler.resetFontFamilyProperty,
50-
MyTextViewStyler.getNativeFontFamilyValue), "MyButton");
51-
}
52-
}
45+
// public static registerHandlers() {
46+
// style.registerHandler(fontFamilyProperty, new style.StylePropertyChangedHandler(
47+
// MyTextViewStyler.setFontFamilyProperty,
48+
// MyTextViewStyler.resetFontFamilyProperty,
49+
// MyTextViewStyler.getNativeFontFamilyValue), "MyButton");
50+
// }
51+
// }
5352

5453
//export class MyStyle extends styles.Style {
5554
// get fontFamily(): string {
@@ -75,7 +74,7 @@ export class MyButton extends buttonModule.Button {
7574

7675
}
7776

78-
MyTextViewStyler.registerHandlers();
77+
// MyTextViewStyler.registerHandlers();
7978

8079
export function createPage() {
8180
var stackLayout = new stackLayoutDef.StackLayout();

tests/app/pages/fonts-test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as stack from "ui/layouts/stack-layout";
22
import * as style from "ui/styling/style";
3+
import {unsetValue} from "ui/core/view";
34

45
export function buttonTap(args) {
56
var stackLayout = <stack.StackLayout>args.object.parent;

tests/app/pages/page13.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export function createPage() {
2323
return page;
2424
}
2525

26-
function addButton(layout: layout.StackLayout, text: "left" | "center" | "middle" | "right" | "stretch") {
26+
function addButton(layout: layout.StackLayout, text: "left" | "center" | "right" | "stretch") {
2727
var btn = new btns.Button();
2828
btn.text = text;
2929
btn.horizontalAlignment = text;

0 commit comments

Comments
 (0)