Skip to content

Commit fd71458

Browse files
authored
feat(angular): support for v10 (#2189)
1 parent b765e02 commit fd71458

File tree

171 files changed

+5775
-10890
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

171 files changed

+5775
-10890
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ node_js:
44
script:
55
- cd nativescript-angular
66
- npm install
7-
- npm run tslint
7+
- npm run format-check
88
- npm pack

CHANGELOG.md

+17
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,23 @@
22
# [9.0.0](https://github.com/NativeScript/nativescript-angular/compare/8.20.4...9.0.0) (2020-06-03)
33

44

5+
6+
### Bug Fixes
7+
8+
* **bindable:** parent referenced expression-values now load properly using an update call ([#8670](https://github.com/NativeScript/NativeScript/issues/8670)) ([6b0028a](https://github.com/NativeScript/NativeScript/commit/6b0028afd7b554914b039cdf371e8e30f6e02dac)), closes [#8666](https://github.com/NativeScript/NativeScript/issues/8666) [#6981](https://github.com/NativeScript/NativeScript/issues/6981) [#5054](https://github.com/NativeScript/NativeScript/issues/5054)
9+
* **scroll-view:** android 'isScrollEnabled' will apply if changed while gesture is underway ([#8695](https://github.com/NativeScript/NativeScript/issues/8695)) ([02ec7f1](https://github.com/NativeScript/NativeScript/commit/02ec7f104d327df53df687ddd1b8ac5b1cdc04ba))
10+
* **snapshots:** android is not defined ([#8691](https://github.com/NativeScript/NativeScript/issues/8691)) ([a8bbd7c](https://github.com/NativeScript/NativeScript/commit/a8bbd7c1e580e77e7ad5ddc7be6845e3d8fb02de))
11+
* **text-view:** only reload text if hint is showing on ios ([#8662](https://github.com/NativeScript/NativeScript/issues/8662)) ([ec17727](https://github.com/NativeScript/NativeScript/commit/ec17727e91f7a3209ada2c7de0bcf59c98c4e62a))
12+
13+
14+
### Features
15+
16+
* **connectivity:** getActiveNetworkInfo and NetworkInfo modern compliance [#8580](https://github.com/NativeScript/NativeScript/issues/8580) ([#8652](https://github.com/NativeScript/NativeScript/issues/8652)) ([635f31f](https://github.com/NativeScript/NativeScript/commit/635f31f81f7826112142c707aff2a66c2b480b0e))
17+
* **dialog:** ios destructive style from options ([#8676](https://github.com/NativeScript/NativeScript/issues/8676)) ([bb531ce](https://github.com/NativeScript/NativeScript/commit/bb531ce71028f9c4fd4d753df16c82104f158e35))
18+
* **ImageSource:** resize method ([#8678](https://github.com/NativeScript/NativeScript/issues/8678)) ([bd12baf](https://github.com/NativeScript/NativeScript/commit/bd12bafb4aae8f1c523be4c7e04fa73722092304))
19+
* **text-view:** allow easy subclassing on ios ([#8663](https://github.com/NativeScript/NativeScript/issues/8663)) ([7d36447](https://github.com/NativeScript/NativeScript/commit/7d364474c23e17acf7696f159d3945d8a73d63e6))
20+
21+
522
### Features
623

724
* angular 9 ivy ([fbe2450](https://github.com/NativeScript/nativescript-angular/commit/fbe2450))

build/pack-scripts/pack-scoped.ts

+13-11
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,29 @@ import { execSync } from "child_process";
55
console.log(`Packing @nativescript/angular package`);
66

77
const distFolderPath = path.resolve("../../dist");
8-
const tempFolderPath = path.resolve("./temp-scoped");
98
const outFileName = "nativescript-angular-scoped.tgz";
109

1110
const nsAngularPackagePath = path.resolve("../../nativescript-angular");
11+
const nsAngularPackageDistPath = path.resolve(nsAngularPackagePath + "/dist");
1212

13-
execSync(`npm install --save-exact`, {
14-
cwd: nsAngularPackagePath
15-
});
13+
function getFilesFromPath(path, extension) {
14+
let files = fs.readdirSync( path );
15+
return files.filter(file => file.match(new RegExp(`.*\.(${extension})`, 'ig')));
16+
}
17+
18+
// execSync(`npm install --save-exact`, {
19+
// cwd: nsAngularPackagePath
20+
// });
1621

1722
// ensure empty temp and dist folders
18-
fs.emptyDirSync(tempFolderPath);
1923
fs.ensureDirSync(distFolderPath);
2024

2125
// create .tgz in temp folder
22-
execSync(`npm pack ${nsAngularPackagePath}`, {
23-
cwd: tempFolderPath
24-
});
26+
execSync(`cd ${nsAngularPackagePath} && npm run build.pack`);
2527

2628
// assume we have a single file built in temp folder, take its name
27-
const currentFileName = fs.readdirSync(tempFolderPath)[0];
29+
const currentFileName = getFilesFromPath(nsAngularPackageDistPath, ".tgz")[0];
30+
console.log('currentFileName:', currentFileName);
2831

2932
// move built file and remove temp folder
30-
fs.moveSync(`${tempFolderPath}/${currentFileName}`, `${distFolderPath}/${outFileName}`, { overwrite: true });
31-
fs.removeSync(`${tempFolderPath}`);
33+
fs.moveSync(`${nsAngularPackageDistPath}/${currentFileName}`, `${distFolderPath}/${outFileName}`, { overwrite: true });

build/pack-scripts/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"compilerOptions": {
33
"module": "commonjs",
4-
"target": "es5",
4+
"target": "es2015",
55
"experimentalDecorators": true,
66
"emitDecoratorMetadata": true,
77
"noEmitHelpers": true,

doc/upgrading-zonejs.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
`nativescript-angular` uses a fork of the `zone.js` package in order to work around incompatibilities between node, browser, and mobile implementations.
44

5-
The fork resides at https://github.com/NativeScript/zone.js in the `zone-nativescript` branch. It adds a separate `lib/nativescript/nativescript.ts` entry point that is used to generate a new bundle: `dist/zone-nativescript.js`.
5+
The fork resides at https://github.com/NativeScript/zone.js in the `zone-nativescript` branch. It adds a separate `lib/nativescript/nativescript.ts` entry point that is used to generate a new bundle: `zone-nativescript.js`.
66

77
To upgrade to a newer release of `zone.js`:
88

@@ -11,5 +11,5 @@ To upgrade to a newer release of `zone.js`:
1111
3. Rebuild: `gulp build`
1212
4. Run the node-based smoke tests: `gulp test/nativescript`
1313
5. Run the browser tests: `node_modules/.bin/karma start karma.conf.js --single-run` (You need to run node `test/ws-server.js` in a separate console first)
14-
6. Commit `dist/zone-nativescript.js`, drop the previous `dist/zone-nativescript.js` commit from the branch. Force push the new `zone-nativescript` branch to GitHub.
14+
6. Commit `zone-nativescript.js`, drop the previous `zone-nativescript.js` commit from the branch. Force push the new `zone-nativescript` branch to GitHub.
1515
7. Update your copy of `nativescript-angular/zone.js/dist/zone-nativescript.js` with the bundle you just built.

e2e/animation-examples/app/App_Resources/iOS/build.xcconfig

-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,3 @@
44
// To build for device with Xcode 8 you need to specify your development team. More info: https://developer.apple.com/library/prerelease/content/releasenotes/DeveloperTools/RN-Xcode/Introduction.html
55
// DEVELOPMENT_TEAM = YOUR_TEAM_ID;
66
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
7-
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.btn-primary {
2+
background-color: pink;
3+
}

e2e/animation-examples/app/animation-builder.component.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import { Component, ViewChild } from '@angular/core';
44
@Component({
55
template: `
66
<Button #button (tap)="makeAnimation()" class="btn btn-primary" automationText="tapToDisappear" text="Tap to disappear!"></Button>
7-
`
7+
`,
8+
styleUrls: ['./animation-builder.component.scss']
89
})
910
export class AnimationBuilderComponent {
1011
@ViewChild('button', { static: false }) button;

e2e/animation-examples/app/app.module.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export function asyncBoot(): Function {
2424
return (): Promise<any> => new Promise(resolve => {
2525
setTimeout(() => {
2626
resolve();
27-
}, 2000);
27+
}, 5000);
2828
})
2929
}
3030

e2e/animation-examples/app/app.routing.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { NgModule } from "@angular/core";
22
import { Routes } from "@angular/router";
3-
import { NativeScriptRouterModule } from "@nativescript/angular/router";
3+
import { NativeScriptRouterModule } from "@nativescript/angular";
44

55
import { AnimationsListComponent } from "./animations-list.component";
66
import { AnimationBuilderComponent } from "./animation-builder.component";

e2e/animation-examples/app/hero/hero-routing.module.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { NgModule } from "@angular/core";
22
import { Routes } from "@angular/router";
3-
import { NativeScriptRouterModule } from "@nativescript/angular/router";
3+
import { NativeScriptRouterModule } from "@nativescript/angular";
44

55
import { HeroTeamBuilderComponent } from './hero-team-builder.component';
66

e2e/animation-examples/app/hero/hero.module.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core";
2-
import { NativeScriptCommonModule } from "@nativescript/angular/common";
2+
import { NativeScriptCommonModule } from "@nativescript/angular";
33

44
import { HeroRoutingModule, routedComponents } from "./hero-routing.module";
55

e2e/animation-examples/app/main.aot.ts

-4
This file was deleted.

e2e/animation-examples/app/main.ts

+45-74
Original file line numberDiff line numberDiff line change
@@ -1,103 +1,74 @@
1-
import { platformNativeScriptDynamic } from "@nativescript/angular/platform";
2-
import { animationsTraceCategory } from "@nativescript/angular/trace";
3-
import { setCategories, enable } from "@nativescript/core/trace";
4-
import {
5-
GridLayout,
6-
ItemSpec,
7-
GridUnitType,
8-
} from '@nativescript/core/ui/layouts/grid-layout';
9-
import {
10-
HorizontalAlignment,
11-
VerticalAlignment,
12-
} from '@nativescript/core/ui/enums/enums';
1+
import { platformNativeScriptDynamic, NativeScriptDebug, AppLaunchView } from "@nativescript/angular";
2+
import { Trace, GridLayout, GridUnitType, ItemSpec, Application } from "@nativescript/core";
133

144
import { AppModule } from "./app.module";
155

16-
setCategories(animationsTraceCategory);
17-
enable();
6+
Trace.setCategories(NativeScriptDebug.animationsTraceCategory);
7+
Trace.enable();
188

19-
class LaunchAnimation extends GridLayout {
9+
class LaunchAnimation extends GridLayout implements AppLaunchView {
2010
circle: GridLayout;
21-
animatedContainer: GridLayout;
2211
finished = false;
12+
complete: () => void;
2313

2414
constructor() {
2515
super();
16+
this.backgroundColor = "#4caef7";
17+
this.className = "w-full h-full";
2618

27-
// setup container to house launch animation
28-
this.animatedContainer = new GridLayout();
29-
this.animatedContainer.style.zIndex = 100;
30-
this.animatedContainer.backgroundColor = '#4caef7';
31-
this.animatedContainer.className = 'w-full h-full';
32-
33-
// any creative animation can be put inside
19+
// construct any creative animation
3420
this.circle = new GridLayout();
3521
this.circle.width = 30;
3622
this.circle.height = 30;
3723
this.circle.borderRadius = 15;
38-
this.circle.horizontalAlignment = HorizontalAlignment.center;
39-
this.circle.verticalAlignment = VerticalAlignment.center;
40-
this.circle.backgroundColor = '#fff';
41-
this.animatedContainer.addRow(new ItemSpec(1, GridUnitType.STAR));
42-
this.animatedContainer.addRow(new ItemSpec(1, GridUnitType.AUTO));
43-
this.animatedContainer.addRow(new ItemSpec(1, GridUnitType.STAR));
44-
GridLayout.setRow(this.circle, 1);
45-
this.animatedContainer.addChild(this.circle);
24+
this.circle.horizontalAlignment = "center";
25+
this.circle.verticalAlignment = "middle";
26+
this.circle.backgroundColor = "#fff";
4627

47-
// add animation to top row since booted app will insert into bottom row
48-
GridLayout.setRow(this.animatedContainer, 1);
49-
this.addChild(this.animatedContainer);
28+
this.addChild(this.circle);
5029
}
5130

52-
startAnimation() {
53-
this.circle
54-
.animate({
55-
scale: { x: 2, y: 2 },
56-
duration: 800,
57-
})
58-
.then(() => {
59-
this.circle
60-
.animate({
61-
scale: { x: 1, y: 1 },
62-
duration: 800,
63-
})
64-
.then(() => {
65-
if (this.finished) {
66-
this.circle
67-
.animate({
68-
scale: { x: 30, y: 30 },
69-
duration: 400,
70-
})
71-
.then(() => {
72-
this.fadeOut();
73-
});
74-
} else {
75-
// keep looping
76-
this.startAnimation();
77-
}
78-
});
31+
async startAnimation() {
32+
await this.circle.animate({
33+
scale: { x: 2, y: 2 },
34+
duration: 800,
35+
});
36+
37+
await this.circle.animate({
38+
scale: { x: 1, y: 1 },
39+
duration: 800,
40+
});
41+
42+
if (this.finished) {
43+
await this.circle.animate({
44+
scale: { x: 30, y: 30 },
45+
duration: 400,
7946
});
47+
this.fadeOut();
48+
} else {
49+
// keep looping
50+
this.startAnimation();
51+
}
8052
}
8153

8254
cleanup() {
83-
this.finished = true;
55+
return new Promise((resolve) => {
56+
this.complete = resolve;
57+
this.finished = true;
58+
});
8459
}
8560

86-
fadeOut() {
87-
this.animatedContainer
88-
.animate({
89-
opacity: 0,
90-
duration: 400,
91-
})
92-
.then(() => {
93-
this._removeView(this.animatedContainer);
94-
this.animatedContainer = null;
95-
this.circle = null;
96-
});
61+
async fadeOut() {
62+
await this.animate({
63+
opacity: 0,
64+
duration: 400,
65+
});
66+
this.complete();
9767
}
9868
}
9969

10070
platformNativeScriptDynamic({
10171
launchView: new LaunchAnimation(),
102-
// backgroundColor: 'purple'
72+
// backgroundColor: 'purple',
73+
// async: true
10374
}).bootstrapModule(AppModule);

e2e/animation-examples/app/vendor.ts

-17
This file was deleted.

e2e/animation-examples/ngcc.config.js

-19
This file was deleted.

0 commit comments

Comments
 (0)