Skip to content

Commit f20ecb7

Browse files
authored
chore: upgrade to NativeScript 3.0 (#17)
1 parent 185a7bf commit f20ecb7

File tree

9 files changed

+392
-36
lines changed

9 files changed

+392
-36
lines changed

Diff for: app/app.routes.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ export const routes = [
4848
routeEntry({ path: 'binding', component: BindingComponent, data: { title: "Binding", isNavigatable: true} }),
4949

5050
routeEntry({ path: 'ListViewExamples', component: ListViewMainPageComponent, data: { title: "ListViewExamples", isNavigatable: true} }),
51-
routeEntry({ path: 'listView/commonTemplate', component: ListViewComponent, data: { title: "commonTemplate" } }),
52-
routeEntry({ path: 'listView/customTemplate', component: ListViewControlComponent, data: { title: "customTemplate" } }),
53-
routeEntry({ path: 'listView/asyncPipeTemplate', component: ListViewAsyncPipeComponent, data: { title: "asyncPipeTemplate" } }),
54-
routeEntry({ path: 'listView/nestedTemplate', component: ListViewWithNestedTemplateComponent, data: { title: "nestedTemplate" } }),
51+
routeEntry({ path: "ListViewExamples/commonTemplate", component: ListViewComponent, data: { title: "commonTemplate" } }),
52+
routeEntry({ path: "ListViewExamples/customTemplate", component: ListViewControlComponent, data: { title: "customTemplate" } }),
53+
routeEntry({ path: "listView/asyncPipeTemplate", component: ListViewAsyncPipeComponent, data: { title: "asyncPipeTemplate" } }),
54+
routeEntry({ path: "listView/nestedTemplate", component: ListViewWithNestedTemplateComponent, data: { title: "nestedTemplate" } }),
5555

5656
routeEntry({ path: 'listPicker', component: ListPickerMainPageComponent, data: { title: "ListPicker", isNavigatable: true } }),
5757
routeEntry({ path: 'listPicker/list-picker', component: ListPickerComponent, data: { title: "ListPicker", isNavigatable: false } }),

Diff for: app/listView/asyncPipeTemplate/async-pipe-template.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ export class DataItem {
1010
template: `
1111
<GridLayout rows='*,60' automationText="mainView">
1212
<ListView [items]="myItems | async">
13-
<template let-item="item" let-i="index" let-odd="odd" let-even="even">
13+
<ng-template let-item="item" let-i="index" let-odd="odd" let-even="even">
1414
<StackLayout [class.odd]="odd" [class.even]="even">
1515
<Label [text]='"index: " + item.name'></Label>
1616
</StackLayout>
17-
</template>
17+
</ng-template>
1818
</ListView>
1919
<TextView row='1' [text]='output' automationText="tvResult" textWrap="true"></TextView>
2020
</GridLayout>
@@ -52,4 +52,4 @@ export class ListViewAsyncPipeComponent {
5252
clearInterval(intervalId);
5353
}, 5000);
5454
}
55-
}
55+
}

Diff for: app/listView/commonTemplate/list-view-page.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ import { Component, Input, ChangeDetectionStrategy } from '@angular/core';
66
template: `
77
<StackLayout automationText="mainView">
88
<ListView [items]="myItems" (itemTap)="onItemTap($event)">
9-
<template let-item="item" let-i="index" let-odd="odd" let-even="even">
9+
<ng-template let-item="item" let-i="index" let-odd="odd" let-even="even">
1010
<StackLayout [class.odd]="odd" [class.even]="even">
1111
<Label [text]='"index: " + i'></Label>
1212
<Label [text]='"[" + item.id +"] " + item.name'></Label>
1313
</StackLayout>
14-
</template>
14+
</ng-template>
1515
</ListView>
1616
<TextView [text]="results" automationText="tvResults" textWrap="true"></TextView>
1717
</StackLayout>
@@ -42,4 +42,4 @@ export class ListViewComponent {
4242

4343
class DataItem {
4444
constructor(public id: number, public name: string) { }
45-
}
45+
}

Diff for: app/listView/customTemplate/list-view-item-template.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ export class CustomTemplate {
1818
template: `
1919
<GridLayout rows="*" automationText="mainView">
2020
<ListView [items]="myItems">
21-
<template let-item="item">
21+
<ng-template let-item="item">
2222
<custom-template [data]="item"></custom-template>
23-
</template>
23+
</ng-template>
2424
</ListView>
2525
</GridLayout>
2626
`,

Diff for: app/listView/listViewMainPage/list-view-main-page.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import { Component } from "@angular/core";
44
selector: "main",
55
template: `
66
<StackLayout>
7-
<Button text="ListView" [nsRouterLink]="['/listView','commonTemplate']"></Button>
8-
<Button text="ListViewCustomTemplate" [nsRouterLink]="['/listView','customTemplate']"></Button>
9-
<Button text="ListViewAsyncPipe" [nsRouterLink]="['/listView','asyncPipeTemplate']"></Button>
10-
<Button text="NestedTemplate" [nsRouterLink]="['/listView','nestedTemplate']"></Button>
11-
</StackLayout>
7+
<Button text="ListView" [nsRouterLink]="'commonTemplate'"></Button>
8+
<Button text="ListViewCustomTemplate" [nsRouterLink]="'customTemplate'"></Button>
9+
<Button text="ListViewAsyncPipe" [nsRouterLink]="['/listView','asyncPipeTemplate']"></Button>
10+
<Button text="NestedTemplate" [nsRouterLink]="['/listView','nestedTemplate']"></Button>
11+
</StackLayout>
1212
`,
1313
})
1414
export class ListViewMainPageComponent { }

Diff for: app/listView/nestedTemplate/list-view-nested-template.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import { Component, ChangeDetectionStrategy } from '@angular/core';
55
template: `
66
<GridLayout rows="* auto" automationText="mainView">
77
<ListView [items]="myItems">
8-
<template let-item="item">
8+
<ng-template let-item="item">
99
<GridLayout>
1010
<Label [text]="'Item ' + item"></Label>
1111
<Label *ngIf="item === 'error'" text="ERROR"></Label>
1212
</GridLayout>
13-
</template>
13+
</ng-template>
1414
</ListView>
1515
1616
<Button text="navigate" row="1" [nsRouterLink]="['/first']"></Button>

Diff for: package.json

+16-16
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,29 @@
1313
}
1414
},
1515
"dependencies": {
16-
"@angular/common": "~4.0.0",
17-
"@angular/compiler": "~4.0.0",
18-
"@angular/core": "~4.0.0",
19-
"@angular/forms": "~4.0.0",
20-
"@angular/http": "~4.0.0",
21-
"@angular/platform-browser": "~4.0.0",
22-
"@angular/platform-browser-dynamic": "~4.0.0",
23-
"@angular/router": "~4.0.0",
24-
"nativescript-angular": "~1.5.0",
16+
"@angular/common": "^4.0.0",
17+
"@angular/compiler": "^4.0.0",
18+
"@angular/core": "^4.0.0",
19+
"@angular/forms": "^4.0.0",
20+
"@angular/http": "^4.0.0",
21+
"@angular/platform-browser": "^4.0.0",
22+
"@angular/platform-browser-dynamic": "^4.0.0",
23+
"@angular/router": "^4.0.0",
24+
"nativescript-angular": "internal-preview",
2525
"nativescript-intl": "~0.0.10",
2626
"reflect-metadata": "~0.1.8",
2727
"rxjs": "^5.2.0",
28-
"tns-core-modules": "~2.5.0",
28+
"tns-core-modules": "^3.0.0 || ^3.0.0-rc.1",
2929
"zone.js": "^0.8.4"
3030
},
3131
"devDependencies": {
32-
"babel-traverse": "6.8.0",
33-
"babel-types": "6.8.1",
34-
"babylon": "6.8.0",
35-
"filewalker": "0.1.2",
32+
"babel-traverse": "^6.24.1",
33+
"babel-types": "^6.24.1",
34+
"babylon": "^6.16.1",
35+
"filewalker": "^0.1.3",
3636
"lazy": "1.0.11",
3737
"nativescript-dev-android-snapshot": "~0.0.6",
38-
"nativescript-dev-typescript": "~0.3.7",
39-
"typescript": "~2.2.1"
38+
"nativescript-dev-typescript": "^0.4.2",
39+
"typescript": "~2.2.2"
4040
}
4141
}

Diff for: tsconfig.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"noEmitOnError": true,
99
"lib": [
1010
"es6",
11-
"dom"
11+
"dom",
12+
"es2015.iterable"
1213
],
1314
"baseUrl": ".",
1415
"paths": {

0 commit comments

Comments
 (0)