From 54b6df669b050b5ad5503f370f50a44a9af501af Mon Sep 17 00:00:00 2001 From: Manol Donev Date: Mon, 17 Dec 2018 15:27:52 +0200 Subject: [PATCH 1/8] fix(android): animator restore logic on simulated nav (#6710) --- tns-core-modules/ui/frame/frame.android.ts | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/tns-core-modules/ui/frame/frame.android.ts b/tns-core-modules/ui/frame/frame.android.ts index 1f56a8eb2..0322aaf3c 100644 --- a/tns-core-modules/ui/frame/frame.android.ts +++ b/tns-core-modules/ui/frame/frame.android.ts @@ -527,10 +527,22 @@ function getAnimatorState(entry: BackstackEntry): AnimatorState { function restoreAnimatorState(entry: BackstackEntry, snapshot: AnimatorState): void { const expandedEntry = entry; - expandedEntry.enterAnimator = snapshot.enterAnimator; - expandedEntry.exitAnimator = snapshot.exitAnimator; - expandedEntry.popEnterAnimator = snapshot.popEnterAnimator; - expandedEntry.popExitAnimator = snapshot.popExitAnimator; + if (snapshot.enterAnimator) { + expandedEntry.enterAnimator = snapshot.enterAnimator; + } + + if (snapshot.exitAnimator) { + expandedEntry.exitAnimator = snapshot.exitAnimator; + } + + if (snapshot.popEnterAnimator) { + expandedEntry.popEnterAnimator = snapshot.popEnterAnimator; + } + + if (snapshot.popExitAnimator) { + expandedEntry.popExitAnimator = snapshot.popExitAnimator; + } + expandedEntry.transitionName = snapshot.transitionName; } From e5f110fe5c781689401533bbafe0d37374d7c100 Mon Sep 17 00:00:00 2001 From: Manol Donev Date: Tue, 18 Dec 2018 10:23:02 +0200 Subject: [PATCH 2/8] fix(android): failure saving state in mixed parent/nested frame nav (#6719) --- tns-core-modules/ui/frame/frame.android.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tns-core-modules/ui/frame/frame.android.ts b/tns-core-modules/ui/frame/frame.android.ts index 0322aaf3c..71e39e4b7 100644 --- a/tns-core-modules/ui/frame/frame.android.ts +++ b/tns-core-modules/ui/frame/frame.android.ts @@ -903,6 +903,12 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks { return null; } + // [nested frames / fragments] see https://github.com/NativeScript/NativeScript/issues/6629 + // retaining reference to a destroyed fragment here somehow causes a cryptic + // "IllegalStateException: Failure saving state: active fragment has cleared index: -1" + // in a specific mixed parent / nested frame navigation scenario + entry.fragment = null; + const page = entry.resolvedPage; if (!page) { traceError(`${fragment}.onDestroy: entry has no resolvedPage`); From ee2c1c42d4131c3dd909f87fd087f8abf9a7ac6d Mon Sep 17 00:00:00 2001 From: Darin Dimitrov Date: Tue, 18 Dec 2018 14:23:27 +0200 Subject: [PATCH 3/8] Fix some lint errors --- apps/app/css-perf-test/main-page.ts | 2 +- apps/app/cuteness.io/main-page.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/app/css-perf-test/main-page.ts b/apps/app/css-perf-test/main-page.ts index c22a93868..eccc8d67c 100644 --- a/apps/app/css-perf-test/main-page.ts +++ b/apps/app/css-perf-test/main-page.ts @@ -1,4 +1,4 @@ -import {EventData as ObservableEventData } from "tns-core-modules/data/observable"; +import { EventData as ObservableEventData } from "tns-core-modules/data/observable"; export function navigatedTo(args: ObservableEventData) { setTimeout(() => { diff --git a/apps/app/cuteness.io/main-page.ts b/apps/app/cuteness.io/main-page.ts index 6fc3b9429..b2a89b2c3 100644 --- a/apps/app/cuteness.io/main-page.ts +++ b/apps/app/cuteness.io/main-page.ts @@ -1,7 +1,7 @@ -import {EventData as ObservableEventData } from "tns-core-modules/data/observable"; +import { EventData as ObservableEventData } from "tns-core-modules/data/observable"; import { Page } from "tns-core-modules/ui/page"; -import {ItemEventData as ListViewItemEventData } from "tns-core-modules/ui/list-view"; -import {topmost as topmostFrame } from "tns-core-modules/ui/frame"; +import { ItemEventData as ListViewItemEventData } from "tns-core-modules/ui/list-view"; +import { topmost as topmostFrame } from "tns-core-modules/ui/frame"; import { AppViewModel } from "./reddit-app-view-model"; var appViewModel = new AppViewModel(); From 1783747014c6c15566dfce41dffbd1334e6660a8 Mon Sep 17 00:00:00 2001 From: SvetoslavTsenov Date: Wed, 19 Dec 2018 14:01:37 +0200 Subject: [PATCH 4/8] release: cut the 5.1.1 release --- CHANGELOG.md | 18 ++++++++++++++++++ tns-core-modules/package.json | 10 +++++----- tns-platform-declarations/package.json | 2 +- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a3ad5f42..48871fdee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,21 @@ + +## [5.1.1](https://github.com/NativeScript/NativeScript/compare/5.1.0...5.1.1) (2018-12-19) + + +### Bug Fixes + +* **android:** animator restore logic on simulated nav ([#6710](https://github.com/NativeScript/NativeScript/issues/6710)) ([54b6df6](https://github.com/NativeScript/NativeScript/commit/54b6df6)) +* **android:** failure saving state in mixed parent/nested frame nav ([#6719](https://github.com/NativeScript/NativeScript/issues/6719)) ([e5f110f](https://github.com/NativeScript/NativeScript/commit/e5f110f)) +* **android:** nested fragment disappears on parent fragment removal ([#6677](https://github.com/NativeScript/NativeScript/issues/6677)) ([c084660](https://github.com/NativeScript/NativeScript/commit/c084660)) + + +### Features + +* **tns-platform-declarations:** Generate iOS typings from iOS 12.1 SDK ([#6693](https://github.com/NativeScript/NativeScript/issues/6693)) ([1c0218e](https://github.com/NativeScript/NativeScript/commit/1c0218e)) +* **view:** added iOS parameter for modal presentation style ([#6409](https://github.com/NativeScript/NativeScript/issues/6409)) ([540b2b4](https://github.com/NativeScript/NativeScript/commit/540b2b4)) + + + # [5.1.0](https://github.com/NativeScript/NativeScript/compare/5.0.5...5.1.0) (2018-12-05) diff --git a/tns-core-modules/package.json b/tns-core-modules/package.json index 17a3e7421..201c94c65 100644 --- a/tns-core-modules/package.json +++ b/tns-core-modules/package.json @@ -1,7 +1,7 @@ { "name": "tns-core-modules", "description": "Telerik NativeScript Core Modules", - "version": "5.2.0", + "version": "5.1.1", "homepage": "https://www.nativescript.org", "repository": { "type": "git", @@ -26,7 +26,7 @@ "license": "Apache-2.0", "typings": "tns-core-modules.d.ts", "dependencies": { - "tns-core-modules-widgets": "next", + "tns-core-modules-widgets": "5.1.1", "tslib": "^1.9.3" }, "devDependencies": { @@ -38,8 +38,8 @@ }, "nativescript": { "platforms": { - "ios": "4.0.0", - "android": "4.0.0" + "ios": "5.0.0", + "android": "5.0.0" } }, "snapshot": { @@ -52,4 +52,4 @@ } } } -} +} \ No newline at end of file diff --git a/tns-platform-declarations/package.json b/tns-platform-declarations/package.json index b3d093a34..826c973d7 100644 --- a/tns-platform-declarations/package.json +++ b/tns-platform-declarations/package.json @@ -1,6 +1,6 @@ { "name": "tns-platform-declarations", - "version": "5.2.0", + "version": "5.1.1", "description": "Platform-specific TypeScript declarations for NativeScript for accessing native objects", "main": "", "scripts": { From 718fb0c7b3e894363efc8a53364cbef191f8996b Mon Sep 17 00:00:00 2001 From: SvetoslavTsenov Date: Wed, 19 Dec 2018 16:20:16 +0200 Subject: [PATCH 5/8] chore: bump widgets version to 5.1.2 --- tns-core-modules/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tns-core-modules/package.json b/tns-core-modules/package.json index 201c94c65..444817415 100644 --- a/tns-core-modules/package.json +++ b/tns-core-modules/package.json @@ -26,7 +26,7 @@ "license": "Apache-2.0", "typings": "tns-core-modules.d.ts", "dependencies": { - "tns-core-modules-widgets": "5.1.1", + "tns-core-modules-widgets": "5.1.2", "tslib": "^1.9.3" }, "devDependencies": { From e03f5f9cf5fe4e0d0484fe0e6020d6166cd19052 Mon Sep 17 00:00:00 2001 From: Alexander Djenkov Date: Tue, 8 Jan 2019 13:48:47 +0200 Subject: [PATCH 6/8] fix(list-view-android): app crashes on ListView item template change (#6634) * fix(list-view): app crashes on first ListView item template change * tests: add tests for changing ListView item template with expression --- .../list-view/dynamic-templates.ts | 21 +++++++++++++++++++ .../list-view/dynamic-templates.xml | 14 +++++++++++++ apps/app/ui-tests-app/list-view/main-page.ts | 1 + .../ui-tests-app/list-view/main-view-model.ts | 17 +++++++++++++-- .../ui/list-view/list-view-common.ts | 5 +++++ 5 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 apps/app/ui-tests-app/list-view/dynamic-templates.ts create mode 100644 apps/app/ui-tests-app/list-view/dynamic-templates.xml diff --git a/apps/app/ui-tests-app/list-view/dynamic-templates.ts b/apps/app/ui-tests-app/list-view/dynamic-templates.ts new file mode 100644 index 000000000..06e973c1d --- /dev/null +++ b/apps/app/ui-tests-app/list-view/dynamic-templates.ts @@ -0,0 +1,21 @@ +import { Page } from "tns-core-modules/ui/page"; +import { ViewModel } from "./main-view-model"; + +export function pageLoaded(args) { + let page = args.object; + const viewModel = new ViewModel(); + + page.bindingContext = { + "items": viewModel.items + } +} + +exports.onItemTap = function (args) { + const list = args.object; + let index = args.index; + let listArray = list.page.bindingContext["items"]; + let currentItem = listArray.getItem(index); + + currentItem.age = currentItem.age + 1; + listArray.setItem(index, currentItem); +} \ No newline at end of file diff --git a/apps/app/ui-tests-app/list-view/dynamic-templates.xml b/apps/app/ui-tests-app/list-view/dynamic-templates.xml new file mode 100644 index 000000000..bca89ebe9 --- /dev/null +++ b/apps/app/ui-tests-app/list-view/dynamic-templates.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/apps/app/ui-tests-app/list-view/main-page.ts b/apps/app/ui-tests-app/list-view/main-page.ts index 2265aec8d..4b7b3e59f 100644 --- a/apps/app/ui-tests-app/list-view/main-page.ts +++ b/apps/app/ui-tests-app/list-view/main-page.ts @@ -13,6 +13,7 @@ export function loadExamples() { const examples = new Map(); examples.set("list-view-templates", "list-view/list-view"); examples.set("images-template", "list-view/images-template"); + examples.set("dynamic-templates", "list-view/dynamic-templates"); examples.set("bindings", "list-view/listview-binding"); examples.set("listview-bg-separator-color", "list-view/listview-bg-separator-color"); examples.set("csslv", "list-view/csslv"); diff --git a/apps/app/ui-tests-app/list-view/main-view-model.ts b/apps/app/ui-tests-app/list-view/main-view-model.ts index 18e6d6866..9ae9bcf14 100644 --- a/apps/app/ui-tests-app/list-view/main-view-model.ts +++ b/apps/app/ui-tests-app/list-view/main-view-model.ts @@ -4,11 +4,13 @@ import { ObservableArray } from "tns-core-modules/data/observable-array"; export class Item extends Observable { private _name: string; private _id: number; + private _age: number; - constructor(name: string, id: number) { + constructor(name: string, id: number, age: number) { super(); this._name = name; this._id = id; + this._age = age; } get name(): string { @@ -33,6 +35,17 @@ export class Item extends Observable { } } + get age(): number { + return this._age; + } + + set age(value: number) { + if (this._age !== value) { + this._age = value; + this.notifyPropertyChange("age", value) + } + } + public toString() { return `${this.name} ${this.id}`; } @@ -44,7 +57,7 @@ export class ViewModel extends Observable { get items(): ObservableArray { this._items = new ObservableArray(); for (let i = 0; i < 100; i++) { - this._items.push(new Item(`Item`, i)); + this._items.push(new Item(`Item`, i, 0)); } return this._items; } diff --git a/tns-core-modules/ui/list-view/list-view-common.ts b/tns-core-modules/ui/list-view/list-view-common.ts index 746b8527b..2c054dbcf 100644 --- a/tns-core-modules/ui/list-view/list-view-common.ts +++ b/tns-core-modules/ui/list-view/list-view-common.ts @@ -66,6 +66,11 @@ export abstract class ListViewBase extends ContainerView implements ListViewDefi }); this._itemTemplateSelector = (item: any, index: number, items: any) => { item["$index"] = index; + + if (this._itemTemplateSelectorBindable.bindingContext === item) { + this._itemTemplateSelectorBindable.bindingContext = null; + } + this._itemTemplateSelectorBindable.bindingContext = item; return this._itemTemplateSelectorBindable.get("templateKey"); }; From c4eb64be0b5778a6cc975c27e2c6ea7236094364 Mon Sep 17 00:00:00 2001 From: SvetoslavTsenov Date: Sun, 13 Jan 2019 16:24:11 +0200 Subject: [PATCH 7/8] release: cut the %s release --- CHANGELOG.md | 10 ++++++++++ tns-core-modules/package.json | 4 ++-- tns-platform-declarations/package.json | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 48871fdee..abac8aa45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ + +## [5.1.2](https://github.com/NativeScript/NativeScript/compare/5.1.1...5.1.2) (2019-01-13) + + +### Bug Fixes + +* **list-view-android:** app crashes on ListView item template change ([#6634](https://github.com/NativeScript/NativeScript/issues/6634)) ([e03f5f9](https://github.com/NativeScript/NativeScript/commit/e03f5f9)) + + + ## [5.1.1](https://github.com/NativeScript/NativeScript/compare/5.1.0...5.1.1) (2018-12-19) diff --git a/tns-core-modules/package.json b/tns-core-modules/package.json index 444817415..64e1bc926 100644 --- a/tns-core-modules/package.json +++ b/tns-core-modules/package.json @@ -1,7 +1,7 @@ { "name": "tns-core-modules", "description": "Telerik NativeScript Core Modules", - "version": "5.1.1", + "version": "5.1.2", "homepage": "https://www.nativescript.org", "repository": { "type": "git", @@ -52,4 +52,4 @@ } } } -} \ No newline at end of file +} diff --git a/tns-platform-declarations/package.json b/tns-platform-declarations/package.json index 826c973d7..7bda26d49 100644 --- a/tns-platform-declarations/package.json +++ b/tns-platform-declarations/package.json @@ -1,6 +1,6 @@ { "name": "tns-platform-declarations", - "version": "5.1.1", + "version": "5.1.2", "description": "Platform-specific TypeScript declarations for NativeScript for accessing native objects", "main": "", "scripts": { From c43537809e2e94e1e0cade396e2f49ca9480522b Mon Sep 17 00:00:00 2001 From: Alexander Djenkov Date: Fri, 4 Jan 2019 16:57:26 +0200 Subject: [PATCH 8/8] fix(tab-view): remove onBackPressed override (#6755) --- tns-core-modules/ui/tab-view/tab-view.android.ts | 9 --------- 1 file changed, 9 deletions(-) diff --git a/tns-core-modules/ui/tab-view/tab-view.android.ts b/tns-core-modules/ui/tab-view/tab-view.android.ts index 6c2302e63..fb214f74e 100644 --- a/tns-core-modules/ui/tab-view/tab-view.android.ts +++ b/tns-core-modules/ui/tab-view/tab-view.android.ts @@ -545,15 +545,6 @@ export class TabView extends TabViewBase { super.disposeNativeView(); } - public onBackPressed(): boolean { - const currentView = this._selectedView; - if (currentView) { - return currentView.onBackPressed(); - } - - return false; - } - public _onRootViewReset(): void { super._onRootViewReset();