From b377eb6ddbebca024940fc00b1fe5c070b67af74 Mon Sep 17 00:00:00 2001 From: Vladimir Amiorkov Date: Mon, 14 Oct 2019 11:25:49 +0300 Subject: [PATCH 1/4] feat(css): add attribute scoped css without global refresh (#7907) (#7947) --- tns-core-modules/application/application.android.ts | 10 ++++++---- tns-core-modules/application/application.d.ts | 3 ++- tns-core-modules/application/application.ios.ts | 10 ++++++---- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/tns-core-modules/application/application.android.ts b/tns-core-modules/application/application.android.ts index 25e04594b..22c7f7c54 100644 --- a/tns-core-modules/application/application.android.ts +++ b/tns-core-modules/application/application.android.ts @@ -177,11 +177,13 @@ export function run(entry?: NavigationEntry | string) { _start(entry); } -export function addCss(cssText: string): void { +export function addCss(cssText: string, attributeScoped?: boolean): void { notify({ eventName: "cssChanged", object: androidApp, cssText: cssText }); - const rootView = getRootView(); - if (rootView) { - rootView._onCssStateChange(); + if (!attributeScoped) { + const rootView = getRootView(); + if (rootView) { + rootView._onCssStateChange(); + } } } diff --git a/tns-core-modules/application/application.d.ts b/tns-core-modules/application/application.d.ts index 48217c411..c64f5102e 100644 --- a/tns-core-modules/application/application.d.ts +++ b/tns-core-modules/application/application.d.ts @@ -171,8 +171,9 @@ export function loadAppCss(); /** * Adds new values to the application styles. * @param cssText - A valid styles which will be added to the current application styles. +* @param attributeScoped - Whether the styles are attribute scoped. Adding attribute scoped styles will not perform a full application styling refresh. */ -export function addCss(cssText: string): void; +export function addCss(cssText: string, attributeScoped?: boolean): void; /** * This event is raised when application css is changed. diff --git a/tns-core-modules/application/application.ios.ts b/tns-core-modules/application/application.ios.ts index 60fd1fda8..84179f943 100644 --- a/tns-core-modules/application/application.ios.ts +++ b/tns-core-modules/application/application.ios.ts @@ -370,11 +370,13 @@ export function run(entry?: string | NavigationEntry) { _start(entry); } -export function addCss(cssText: string): void { +export function addCss(cssText: string, attributeScoped?: boolean): void { notify({ eventName: "cssChanged", object: iosApp, cssText: cssText }); - const rootView = getRootView(); - if (rootView) { - rootView._onCssStateChange(); + if (!attributeScoped) { + const rootView = getRootView(); + if (rootView) { + rootView._onCssStateChange(); + } } } From ff30c4861fa34afd21501f9cc92020505614c6ef Mon Sep 17 00:00:00 2001 From: Manol Donev Date: Tue, 15 Oct 2019 11:28:53 +0300 Subject: [PATCH 2/4] fix(frame-android): IllegalStateException: The specified child already has a parent (#7948) --- tns-core-modules/ui/frame/frame.android.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tns-core-modules/ui/frame/frame.android.ts b/tns-core-modules/ui/frame/frame.android.ts index fc52f37b8..b3d3d8f2b 100644 --- a/tns-core-modules/ui/frame/frame.android.ts +++ b/tns-core-modules/ui/frame/frame.android.ts @@ -902,7 +902,7 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks { parentView.addViewInLayout(nativeView, -1, new org.nativescript.widgets.CommonLayoutParams()); } - parentView.removeView(nativeView); + parentView.removeAllViews(); } } From 7fe8d1c339d148b759ea58b4074be3093a8e81a1 Mon Sep 17 00:00:00 2001 From: Manol Donev Date: Tue, 15 Oct 2019 13:32:35 +0300 Subject: [PATCH 3/4] fix(tabs-ios9): no view controller managing visible view error (#7837) --- tests/app/ui/image-cache/image-cache-tests.ts | 3 ++- tests/app/xml-parser-tests/xml-parser-tests.ts | 13 +++++++++++++ tns-core-modules/ui/tabs/tabs.ios.ts | 16 +++++++++++++++- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/tests/app/ui/image-cache/image-cache-tests.ts b/tests/app/ui/image-cache/image-cache-tests.ts index c5c66b69d..3e9b73f44 100644 --- a/tests/app/ui/image-cache/image-cache-tests.ts +++ b/tests/app/ui/image-cache/image-cache-tests.ts @@ -1,6 +1,7 @@ import * as imageCacheModule from "tns-core-modules/ui/image-cache"; import * as imageSource from "tns-core-modules/image-source"; import * as types from "tns-core-modules/utils/types"; +import { isAndroid } from "tns-core-modules/platform"; import { device } from "tns-core-modules/platform"; import lazy from "tns-core-modules/utils/lazy"; @@ -10,7 +11,7 @@ const sdkVersion = lazy(() => parseInt(device.sdkVersion)); export const test_ImageCache_ValidUrl = function() { // see https://github.com/NativeScript/NativeScript/issues/6643 - if (sdkVersion() < 20) { + if (isAndroid && sdkVersion() < 20) { return; } diff --git a/tests/app/xml-parser-tests/xml-parser-tests.ts b/tests/app/xml-parser-tests/xml-parser-tests.ts index e1949ba1c..65f9e81d8 100644 --- a/tests/app/xml-parser-tests/xml-parser-tests.ts +++ b/tests/app/xml-parser-tests/xml-parser-tests.ts @@ -6,6 +6,11 @@ import * as TKUnit from "../tk-unit"; import * as xmlModule from "tns-core-modules/xml"; import * as fs from "tns-core-modules/file-system"; import * as builder from "tns-core-modules/ui/builder"; +import { isIOS } from "tns-core-modules/platform"; +import { device } from "tns-core-modules/platform"; +import lazy from "tns-core-modules/utils/lazy"; + +const sdkVersion = lazy(() => parseInt(device.sdkVersion)); export var test_XmlParser_IsDefined = function () { TKUnit.assertNotEqual(xmlModule.XmlParser, undefined, "Class XmlParser should be defined!"); @@ -94,6 +99,10 @@ export var test_XmlParser_OnErrorIsCalledWhenAnErrorOccurs = function () { }; export var test_XmlParser_IntegrationTest = function () { + if (isIOS && sdkVersion() < 10) { + return; + } + var actualResult = ""; var xmlParser = new xmlModule.XmlParser(function (event: xmlModule.ParserEvent) { if (event.eventType === xmlModule.ParserEventType.Text && event.data.trim() === "") { @@ -194,6 +203,10 @@ export var test_XmlParser_DummyDocumentationTest = function () { }; export var test_XmlParser_NamespacesTest = function () { + if (isIOS && sdkVersion() < 10) { + return; + } + var xmlParser = new xmlModule.XmlParser(function (event: xmlModule.ParserEvent) { if (event.eventType !== xmlModule.ParserEventType.StartElement) { return; diff --git a/tns-core-modules/ui/tabs/tabs.ios.ts b/tns-core-modules/ui/tabs/tabs.ios.ts index be26ca1b0..f660e514b 100644 --- a/tns-core-modules/ui/tabs/tabs.ios.ts +++ b/tns-core-modules/ui/tabs/tabs.ios.ts @@ -22,7 +22,16 @@ import { swipeEnabledProperty, TabsBase } from "./tabs-common"; export * from "./tabs-common"; const majorVersion = iosUtils.MajorVersion; -// const isPhone = device.deviceType === "Phone"; + +// Equivalent to dispatch_async(dispatch_get_main_queue(...)) call +const invokeOnRunLoop = (function() { + const runloop = CFRunLoopGetMain(); + + return (action: () => any) => { + CFRunLoopPerformBlock(runloop, kCFRunLoopDefaultMode, action); + CFRunLoopWakeUp(runloop); + }; +}()); class MDCTabBarDelegateImpl extends NSObject implements MDCTabBarDelegate { public static ObjCProtocols = [MDCTabBarDelegate]; @@ -1052,6 +1061,11 @@ export class Tabs extends TabsBase { this._currentNativeSelectedIndex = value; this.viewController.setViewControllersDirectionAnimatedCompletion(controllers, navigationDirection, true, (finished: boolean) => { if (finished) { + if (majorVersion < 10) { + // HACK: UIPageViewController fix; see https://stackoverflow.com/a/17330606 + invokeOnRunLoop(() => this.viewController.setViewControllersDirectionAnimatedCompletion(controllers, navigationDirection, false, null)); + } + this._canSelectItem = true; this._setCanBeLoaded(value); this._loadUnloadTabItems(value); From a3173456cff4faa92f5318a65c1e53dbfd2c49e1 Mon Sep 17 00:00:00 2001 From: Svetoslav Date: Tue, 15 Oct 2019 16:04:51 +0300 Subject: [PATCH 4/4] docs: cut the 6.1.2 release (#7960) --- CHANGELOG.md | 17 +++++++++++++++++ tns-core-modules-widgets/package.json | 2 +- tns-core-modules/package.json | 2 +- tns-platform-declarations/package.json | 2 +- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e511bdab1..7dc5973a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,20 @@ + +## [6.1.2](https://github.com/NativeScript/NativeScript/compare/6.1.1...6.1.2) (2019-10-15) + + +### Bug Fixes + +* expose orientation to application module ([#7832](https://github.com/NativeScript/NativeScript/issues/7832)) ([4166e2d](https://github.com/NativeScript/NativeScript/commit/4166e2d)) +* **frame-android:** IllegalStateException: The specified child already has a parent ([#7948](https://github.com/NativeScript/NativeScript/issues/7948)) ([ff30c48](https://github.com/NativeScript/NativeScript/commit/ff30c48)) +* **tabs-ios9:** no view controller managing visible view error ([#7837](https://github.com/NativeScript/NativeScript/issues/7837)) ([7fe8d1c](https://github.com/NativeScript/NativeScript/commit/7fe8d1c)) + + +### Features + +* **css:** add attribute scoped css without global refresh ([#7907](https://github.com/NativeScript/NativeScript/issues/7907)) ([#7947](https://github.com/NativeScript/NativeScript/issues/7947)) ([b377eb6](https://github.com/NativeScript/NativeScript/commit/b377eb6)) + + + ## [6.1.1](https://github.com/NativeScript/NativeScript/compare/6.1.0...6.1.1) (2019-09-11) diff --git a/tns-core-modules-widgets/package.json b/tns-core-modules-widgets/package.json index 57c5a34bf..0d90cb53c 100644 --- a/tns-core-modules-widgets/package.json +++ b/tns-core-modules-widgets/package.json @@ -1,6 +1,6 @@ { "name": "tns-core-modules-widgets", - "version": "6.1.0", + "version": "6.1.2", "description": "Native widgets used in the NativeScript framework.", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" diff --git a/tns-core-modules/package.json b/tns-core-modules/package.json index 8ee9d95f3..f8f890e7e 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": "6.1.1", + "version": "6.1.2", "homepage": "https://www.nativescript.org", "repository": { "type": "git", diff --git a/tns-platform-declarations/package.json b/tns-platform-declarations/package.json index 83ee96fc8..1bcf512f6 100644 --- a/tns-platform-declarations/package.json +++ b/tns-platform-declarations/package.json @@ -1,6 +1,6 @@ { "name": "tns-platform-declarations", - "version": "6.1.1", + "version": "6.1.2", "description": "Platform-specific TypeScript declarations for NativeScript for accessing native objects", "main": "", "scripts": {