From 496c46d784a742beb527b72cf72f8459a93fcad4 Mon Sep 17 00:00:00 2001 From: Eduardo Speroni Date: Wed, 12 Feb 2020 13:30:21 -0300 Subject: [PATCH 1/7] fix(list-view): wrap ChangeDetection in ng zone --- .../directives/templated-items-comp.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/nativescript-angular/directives/templated-items-comp.ts b/nativescript-angular/directives/templated-items-comp.ts index 69aaabfed..96a943772 100644 --- a/nativescript-angular/directives/templated-items-comp.ts +++ b/nativescript-angular/directives/templated-items-comp.ts @@ -12,6 +12,7 @@ import { Input, IterableDiffer, IterableDiffers, + NgZone, OnDestroy, Output, TemplateRef, @@ -84,7 +85,8 @@ export abstract class TemplatedItemsComponent implements DoCheck, OnDestroy, Aft } constructor(_elementRef: ElementRef, - private _iterableDiffers: IterableDiffers) { + private _iterableDiffers: IterableDiffers, + private zone: NgZone) { this.templatedItemsView = _elementRef.nativeElement; this.templatedItemsView.on("itemLoading", this.onItemLoading, this); @@ -218,8 +220,10 @@ export abstract class TemplatedItemsComponent implements DoCheck, OnDestroy, Aft listViewLog(`Manually detect changes in child: ${index}`); } - viewRef.markForCheck(); - viewRef.detectChanges(); + this.zone.run(() => { + viewRef.markForCheck(); + viewRef.detectChanges(); + }); } ngDoCheck() { From a1caad598b21f089149e05f5ee266275066938e9 Mon Sep 17 00:00:00 2001 From: Eduardo Speroni Date: Wed, 12 Feb 2020 13:31:19 -0300 Subject: [PATCH 2/7] fix(zone): patch AnimationFrame --- nativescript-angular/zone-js/dist/zone-nativescript.js | 1 + 1 file changed, 1 insertion(+) diff --git a/nativescript-angular/zone-js/dist/zone-nativescript.js b/nativescript-angular/zone-js/dist/zone-nativescript.js index 95756327a..296720062 100644 --- a/nativescript-angular/zone-js/dist/zone-nativescript.js +++ b/nativescript-angular/zone-js/dist/zone-nativescript.js @@ -1676,5 +1676,6 @@ var clear = 'clear'; patchTimer(global, set, clear, 'Timeout'); patchTimer(global, set, clear, 'Interval'); patchTimer(global, set, clear, 'Immediate'); +patchTimer(global, 'request', 'cancel', 'AnimationFrame'); }))); From 29c3e8cdb87c33f5bb4d0008834765d1b44e005e Mon Sep 17 00:00:00 2001 From: Eduardo Speroni Date: Wed, 12 Feb 2020 13:41:38 -0300 Subject: [PATCH 3/7] fix(dialogs): wrap angular calls in ng zone --- nativescript-angular/directives/dialogs.ts | 35 ++++++++++++---------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/nativescript-angular/directives/dialogs.ts b/nativescript-angular/directives/dialogs.ts index 14463c533..56aea4466 100644 --- a/nativescript-angular/directives/dialogs.ts +++ b/nativescript-angular/directives/dialogs.ts @@ -5,6 +5,7 @@ import { Injectable, Injector, NgModuleRef, + NgZone, Type, ViewContainerRef } from "@angular/core"; @@ -48,7 +49,7 @@ interface ShowDialogOptions extends BaseShowModalOptions { @Injectable() export class ModalDialogService { - constructor(private location: NSLocationStrategy) { + constructor(private location: NSLocationStrategy, private zone: NgZone) { } public showModal(type: Type, @@ -120,8 +121,10 @@ export class ModalDialogService { if (componentView) { componentView.closeModal(); this.location._closeModalNavigation(); - detachedLoaderRef.instance.detectChanges(); - detachedLoaderRef.destroy(); + this.zone.run(() => { + detachedLoaderRef.instance.detectChanges(); + detachedLoaderRef.destroy(); + }); } }); @@ -132,21 +135,23 @@ export class ModalDialogService { parent: options.containerRef.injector }); const detachedFactory = options.resolver.resolveComponentFactory(DetachedLoader); - detachedLoaderRef = options.containerRef.createComponent(detachedFactory, -1, childInjector, null); - detachedLoaderRef.instance.loadComponent(options.type).then((compRef) => { - const detachedProxy = compRef.location.nativeElement; + this.zone.run(() => { + detachedLoaderRef = options.containerRef.createComponent(detachedFactory, -1, childInjector, null); + detachedLoaderRef.instance.loadComponent(options.type).then((compRef) => { + const detachedProxy = compRef.location.nativeElement; - if (detachedProxy.getChildrenCount() > 1) { - throw new Error("Modal content has more than one root view."); - } - componentView = detachedProxy.getChildAt(0); + if (detachedProxy.getChildrenCount() > 1) { + throw new Error("Modal content has more than one root view."); + } + componentView = detachedProxy.getChildAt(0); - if (componentView.parent) { - (componentView.parent)._ngDialogRoot = componentView; - (componentView.parent).removeChild(componentView); - } + if (componentView.parent) { + (componentView.parent)._ngDialogRoot = componentView; + (componentView.parent).removeChild(componentView); + } - options.parentView.showModal(componentView, { ...options, closeCallback }); + options.parentView.showModal(componentView, { ...options, closeCallback }); + }); }); } } From 308dd978cb4b03aed1540e3f673080143ff1e4af Mon Sep 17 00:00:00 2001 From: Eduardo Speroni Date: Wed, 12 Feb 2020 13:45:28 -0300 Subject: [PATCH 4/7] fix missing zone injection --- nativescript-angular/directives/list-view-comp.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nativescript-angular/directives/list-view-comp.ts b/nativescript-angular/directives/list-view-comp.ts index da3a19d5b..24533918d 100644 --- a/nativescript-angular/directives/list-view-comp.ts +++ b/nativescript-angular/directives/list-view-comp.ts @@ -3,7 +3,8 @@ import { Component, ElementRef, IterableDiffers, - forwardRef + forwardRef, + NgZone } from "@angular/core"; import { ListView } from "tns-core-modules/ui/list-view"; import { TEMPLATED_ITEMS_COMPONENT, TemplatedItemsComponent } from "./templated-items-comp"; @@ -25,7 +26,7 @@ export class ListViewComponent extends TemplatedItemsComponent { protected templatedItemsView: ListView; constructor(_elementRef: ElementRef, - _iterableDiffers: IterableDiffers) { - super(_elementRef, _iterableDiffers); + _iterableDiffers: IterableDiffers, zone: NgZone) { + super(_elementRef, _iterableDiffers, zone); } } From 7d49a4dd2db08309b52119f497e1eb5db11a60e5 Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Wed, 2 Sep 2020 21:14:59 -0700 Subject: [PATCH 5/7] chore: bump --- e2e/animation-examples/package.json | 30 ++++++++++---------- nativescript-angular/index.ts | 10 +++---- nativescript-angular/package.json | 43 ++++++++++++++--------------- 3 files changed, 41 insertions(+), 42 deletions(-) diff --git a/e2e/animation-examples/package.json b/e2e/animation-examples/package.json index d000ce3e0..4dc7fdd61 100644 --- a/e2e/animation-examples/package.json +++ b/e2e/animation-examples/package.json @@ -13,24 +13,24 @@ } }, "dependencies": { - "@angular/animations": "~10.0.0", - "@angular/common": "~10.0.0", - "@angular/compiler": "~10.0.0", - "@angular/core": "~10.0.0", - "@angular/forms": "~10.0.0", - "@angular/platform-browser": "~10.0.0", - "@angular/platform-browser-dynamic": "~10.0.0", - "@angular/router": "~10.0.0", + "@angular/animations": "~10.1.0", + "@angular/common": "~10.1.0", + "@angular/compiler": "~10.1.0", + "@angular/core": "~10.1.0", + "@angular/forms": "~10.1.0", + "@angular/platform-browser": "~10.1.0", + "@angular/platform-browser-dynamic": "~10.1.0", + "@angular/router": "~10.1.0", "@nativescript/angular": "file:../../dist/nativescript-angular-scoped.tgz", "nativescript-theme-core": "~1.0.2", - "reflect-metadata": "~0.1.8", - "rxjs": "~6.5.5", - "@nativescript/core": "rc", - "zone.js": "^0.10.3" + "reflect-metadata": "~0.1.13", + "rxjs": "~6.6.0", + "@nativescript/core": "~7.0.0", + "zone.js": "^0.11.1" }, "devDependencies": { - "@angular/compiler-cli": "~10.0.0", - "@ngtools/webpack": "~10.0.0", + "@angular/compiler-cli": "~10.1.0", + "@ngtools/webpack": "~10.1.0", "@types/chai": "~4.2.0", "@types/mocha": "~7.0.0", "@types/node": "~14.0.0", @@ -43,7 +43,7 @@ "mochawesome": "~6.1.1", "node-sass": "~4.14.1", "nativescript-css-loader": "~0.26.0", - "@nativescript/webpack": "rc", + "@nativescript/webpack": "~3.0.0", "typescript": "~3.9.0" }, "scripts": { diff --git a/nativescript-angular/index.ts b/nativescript-angular/index.ts index 6244a00e5..5eae5ffcb 100644 --- a/nativescript-angular/index.ts +++ b/nativescript-angular/index.ts @@ -1,13 +1,13 @@ // Initial imports and polyfills -import '@nativescript/core'; -import '@nativescript/zone-js'; +require('@nativescript/core'); +require('@nativescript/zone-js'); // TODO: migrate to standard zone.js if possible // investigate Ivy with templated-items-comp to allow standard zone below to be used instead of patched {N} zone above // import 'zone.js/dist/zone'; -import './dom-adapter'; -import 'nativescript-intl'; +require('./dom-adapter'); +require('nativescript-intl'); // import "./polyfills/array"; -import './polyfills/console'; +require('./polyfills/console'); export * from './platform-common'; export * from './platform-providers'; diff --git a/nativescript-angular/package.json b/nativescript-angular/package.json index 067cdbc0f..9af5414c1 100644 --- a/nativescript-angular/package.json +++ b/nativescript-angular/package.json @@ -1,6 +1,6 @@ { "name": "@nativescript/angular", - "version": "10.0.3", + "version": "10.1.0", "description": "An Angular renderer that lets you build mobile apps with NativeScript.", "homepage": "https://www.nativescript.org/", "bugs": "https://github.com/NativeScript/nativescript-angular/issues", @@ -58,42 +58,41 @@ }, "dependencies": { "@nativescript/zone-js": "~1.0.0", - "nativescript-angular": "~10.0.0", "nativescript-intl": "^4.0.0" }, "peerDependencies": { - "@angular/common": "^10.0.0", - "@angular/compiler": "^10.0.0", - "@angular/core": "^10.0.0", - "@angular/forms": "^10.0.0", - "@angular/platform-browser": "^10.0.0", - "@angular/platform-browser-dynamic": "^10.0.0", - "@angular/router": "^10.0.0" + "@angular/common": "^10.1.0", + "@angular/compiler": "^10.1.0", + "@angular/core": "^10.1.0", + "@angular/forms": "^10.1.0", + "@angular/platform-browser": "^10.1.0", + "@angular/platform-browser-dynamic": "^10.1.0", + "@angular/router": "^10.1.0" }, "devDependencies": { - "@angular/animations": "~10.0.0", - "@angular/common": "~10.0.0", - "@angular/compiler": "~10.0.0", - "@angular/compiler-cli": "~10.0.0", - "@angular/core": "~10.0.0", - "@angular/forms": "~10.0.0", - "@angular/platform-browser": "~10.0.0", - "@angular/platform-browser-dynamic": "~10.0.0", - "@angular/router": "~10.0.0", - "@nativescript/core": "rc", + "@angular/animations": "~10.1.0", + "@angular/common": "~10.1.0", + "@angular/compiler": "~10.1.0", + "@angular/compiler-cli": "~10.1.0", + "@angular/core": "~10.1.0", + "@angular/forms": "~10.1.0", + "@angular/platform-browser": "~10.1.0", + "@angular/platform-browser-dynamic": "~10.1.0", + "@angular/router": "~10.1.0", + "@nativescript/core": "~7.0.0", "codelyzer": "^5.2.0", "conventional-changelog-cli": "^2.0.34", "husky": "^4.2.5", "lint-staged": "^10.2.11", "nativescript-typedoc-theme": "git://github.com/NativeScript/nativescript-typedoc-theme.git#master", - "ng-packagr": "~10.0.0", + "ng-packagr": "~10.1.0", "prettier": "^2.0.5", - "rxjs": "~6.5.5", + "rxjs": "~6.6.0", "tslint": "^6.1.2", "tslint-config-prettier": "^1.18.0", "typedoc": "~0.17.0", "typescript": "~3.9.0", - "zone.js": "^0.10.3" + "zone.js": "^0.11.1" }, "husky": { "hooks": { From 9feea4b65672e23b8168b32225193be7ef6dda47 Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Wed, 2 Sep 2020 22:09:53 -0700 Subject: [PATCH 6/7] chore: ng 10.1 and ns 7 --- e2e/animation-examples/app/package.json | 9 ------ e2e/animation-examples/nativescript.config.ts | 11 ++++++++ e2e/animation-examples/package.json | 21 +++++--------- e2e/tests-app-ng/package.json | 28 +++++++++---------- e2e/tests-app-ng/references.d.ts | 2 +- nativescript-angular/index.ts | 10 +++---- 6 files changed, 38 insertions(+), 43 deletions(-) delete mode 100644 e2e/animation-examples/app/package.json create mode 100644 e2e/animation-examples/nativescript.config.ts diff --git a/e2e/animation-examples/app/package.json b/e2e/animation-examples/app/package.json deleted file mode 100644 index 706d1a31b..000000000 --- a/e2e/animation-examples/app/package.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "main": "main.js", - "name": "nativescript-template-ng-tutorial", - "version": "3.1.0", - "android": { - "v8Flags": "--expose_gc", - "markingMode": "none" - } -} \ No newline at end of file diff --git a/e2e/animation-examples/nativescript.config.ts b/e2e/animation-examples/nativescript.config.ts new file mode 100644 index 000000000..d117ed3e9 --- /dev/null +++ b/e2e/animation-examples/nativescript.config.ts @@ -0,0 +1,11 @@ +import { NativeScriptConfig } from '@nativescript/core' + +export default { + id: 'org.nativescript.ng4animations', + appResourcesPath: 'app/App_Resources', + android: { + v8Flags: '--expose_gc', + markingMode: 'none', + }, + appPath: 'app', +} as NativeScriptConfig diff --git a/e2e/animation-examples/package.json b/e2e/animation-examples/package.json index 4dc7fdd61..db7a45c75 100644 --- a/e2e/animation-examples/package.json +++ b/e2e/animation-examples/package.json @@ -1,17 +1,9 @@ { "description": "NativeScript Application", + "main": "main.js", "license": "SEE LICENSE IN ", "readme": "NativeScript Application", "repository": "", - "nativescript": { - "id": "org.nativescript.ng4animations", - "tns-ios": { - "version": "6.5.2" - }, - "tns-android": { - "version": "latest" - } - }, "dependencies": { "@angular/animations": "~10.1.0", "@angular/common": "~10.1.0", @@ -30,6 +22,8 @@ }, "devDependencies": { "@angular/compiler-cli": "~10.1.0", + "@nativescript/ios": "7.0.0", + "@nativescript/webpack": "~3.0.0", "@ngtools/webpack": "~10.1.0", "@types/chai": "~4.2.0", "@types/mocha": "~7.0.0", @@ -41,13 +35,12 @@ "lazy": "~1.0.11", "mocha": "~8.0.1", "mochawesome": "~6.1.1", - "node-sass": "~4.14.1", "nativescript-css-loader": "~0.26.0", - "@nativescript/webpack": "~3.0.0", + "node-sass": "~4.14.1", "typescript": "~3.9.0" }, "scripts": { - "clean": "npx rimraf hooks node_modules platforms package-lock.json", + "clean": "ns clean", "setup": "cd ../../nativescript-angular && npm run prep.apps && cd ../e2e/animation-examples && npm run clean", "ngcc": "ngcc --properties es2015 module main --first-only", "postinstall": "npm run ngcc", @@ -56,7 +49,7 @@ "e2e-watch": "tsc -p e2e --watch", "ns-verify-bundle": "ns-verify-bundle", "update-ns-webpack": "update-ns-webpack", - "ios": "tns debug ios --emulator --no-hmr", - "android": "tns debug android --emulator --no-hmr" + "ios": "ns debug ios --emulator --no-hmr", + "android": "ns debug android --emulator --no-hmr" } } diff --git a/e2e/tests-app-ng/package.json b/e2e/tests-app-ng/package.json index e9c720517..2b288597b 100644 --- a/e2e/tests-app-ng/package.json +++ b/e2e/tests-app-ng/package.json @@ -13,31 +13,31 @@ } }, "dependencies": { - "@angular/animations": "~10.0.0", - "@angular/common": "~10.0.0", - "@angular/compiler": "~10.0.0", - "@angular/core": "~10.0.0", - "@angular/forms": "~10.0.0", - "@angular/platform-browser": "~10.0.0", - "@angular/platform-browser-dynamic": "~10.0.0", - "@angular/router": "~10.0.0", + "@angular/animations": "~10.1.0", + "@angular/common": "~10.1.0", + "@angular/compiler": "~10.1.0", + "@angular/core": "~10.1.0", + "@angular/forms": "~10.1.0", + "@angular/platform-browser": "~10.1.0", + "@angular/platform-browser-dynamic": "~10.1.0", + "@angular/router": "~10.1.0", "@nativescript/angular": "file:../../dist/nativescript-angular-scoped.tgz", "nativescript-theme-core": "^1.0.4", "reflect-metadata": "~0.1.8", - "rxjs": "~6.5.5", - "@nativescript/core": "rc", - "zone.js": "^0.10.3" + "rxjs": "~6.6.0", + "@nativescript/core": "~7.0.0", + "zone.js": "^0.11.1" }, "devDependencies": { - "@angular/compiler-cli": "~10.0.0", - "@ngtools/webpack": "~10.0.0", + "@angular/compiler-cli": "~10.1.0", + "@ngtools/webpack": "~10.1.0", "babel-traverse": "6.24.1", "babel-types": "6.24.1", "babylon": "6.17.0", "codelyzer": "^5.1.0", "filewalker": "^0.1.3", "lazy": "1.0.11", - "@nativescript/webpack": "~2.1.1", + "@nativescript/webpack": "~3.0.0", "typescript": "~3.9.0" }, "scripts": { diff --git a/e2e/tests-app-ng/references.d.ts b/e2e/tests-app-ng/references.d.ts index b14f3837d..a5bb99810 100644 --- a/e2e/tests-app-ng/references.d.ts +++ b/e2e/tests-app-ng/references.d.ts @@ -1 +1 @@ -/// Needed for autocompletion and compilation. \ No newline at end of file +/// \ No newline at end of file diff --git a/nativescript-angular/index.ts b/nativescript-angular/index.ts index 5eae5ffcb..f0e97a09c 100644 --- a/nativescript-angular/index.ts +++ b/nativescript-angular/index.ts @@ -1,13 +1,13 @@ // Initial imports and polyfills -require('@nativescript/core'); -require('@nativescript/zone-js'); +import '@nativescript/core'; +import '@nativescript/zone-js'; // TODO: migrate to standard zone.js if possible // investigate Ivy with templated-items-comp to allow standard zone below to be used instead of patched {N} zone above // import 'zone.js/dist/zone'; -require('./dom-adapter'); -require('nativescript-intl'); +import './dom-adapter'; // import "./polyfills/array"; -require('./polyfills/console'); +import './polyfills/console'; +import 'nativescript-intl'; export * from './platform-common'; export * from './platform-providers'; From e7d3faf99e033815897824bce8f713daf81c3b2c Mon Sep 17 00:00:00 2001 From: Eduardo Speroni Date: Thu, 3 Sep 2020 19:12:15 -0300 Subject: [PATCH 7/7] chore: fix linting --- nativescript-angular/directives/dialogs.ts | 4 ++-- nativescript-angular/directives/templated-items-comp.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nativescript-angular/directives/dialogs.ts b/nativescript-angular/directives/dialogs.ts index ec0c96bc1..7e5aa78bf 100644 --- a/nativescript-angular/directives/dialogs.ts +++ b/nativescript-angular/directives/dialogs.ts @@ -27,12 +27,12 @@ export interface ShowDialogOptions extends BaseShowModalOptions { } export class ModalDialogParams { - constructor(public context: any = {}, public closeCallback: (...args) => any) { } + constructor(public context: any = {}, public closeCallback: (...args) => any) {} } @Injectable() export class ModalDialogService { - constructor(private location: NSLocationStrategy, private zone: NgZone) { } + constructor(private location: NSLocationStrategy, private zone: NgZone) {} public showModal(type: Type, options: ModalDialogOptions): Promise { if (!options.viewContainerRef) { diff --git a/nativescript-angular/directives/templated-items-comp.ts b/nativescript-angular/directives/templated-items-comp.ts index 44ee5a2ba..5514ffa7b 100644 --- a/nativescript-angular/directives/templated-items-comp.ts +++ b/nativescript-angular/directives/templated-items-comp.ts @@ -7,7 +7,7 @@ import { NativeScriptDebug } from '../trace'; const NG_VIEW = '_ngViewRef'; export class ItemContext { - constructor(public $implicit?: any, public item?: any, public index?: number, public even?: boolean, public odd?: boolean) { } + constructor(public $implicit?: any, public item?: any, public index?: number, public even?: boolean, public odd?: boolean) {} } export interface SetupItemViewArgs { @@ -228,7 +228,7 @@ export const TEMPLATED_ITEMS_COMPONENT = new InjectionToken, @Inject(TEMPLATED_ITEMS_COMPONENT) @Host() private comp: TemplatedItemsComponent) { } + constructor(private templateRef: TemplateRef, @Inject(TEMPLATED_ITEMS_COMPONENT) @Host() private comp: TemplatedItemsComponent) {} @Input() set nsTemplateKey(value: any) { pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy