diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e56ca170..a7658cf84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,21 @@ + +## [6.2.1](https://github.com/NativeScript/NativeScript/compare/6.2.0...6.2.1) (2019-11-12) + + +### Bug Fixes + +* **dark-mode:** formatted string and html view text color ([#8031](https://github.com/NativeScript/NativeScript/issues/8031)) ([0c7f838](https://github.com/NativeScript/NativeScript/commit/0c7f838)) +* ensure @CallSuper native methods call superFunc ([#8025](https://github.com/NativeScript/NativeScript/issues/8025)) ([7fa9978](https://github.com/NativeScript/NativeScript/commit/7fa9978)) +* **dev-tools:** use app root in getDocument() ([#8071](https://github.com/NativeScript/NativeScript/issues/8071)) ([f686472](https://github.com/NativeScript/NativeScript/commit/f686472)) +* **gradient:** import LinearGradient with alias ([#8063](https://github.com/NativeScript/NativeScript/issues/8063)) ([eb33ede](https://github.com/NativeScript/NativeScript/commit/eb33ede)) + + +### Features + +* **application:** add system appearance changed event to typings ([#8034](https://github.com/NativeScript/NativeScript/issues/8034)) ([2a34368](https://github.com/NativeScript/NativeScript/commit/2a34368)) + + + # [6.2.0](https://github.com/NativeScript/NativeScript/compare/6.1.2...6.2.0) (2019-10-24) diff --git a/nativescript-core/debugger/devtools-elements.common.ts b/nativescript-core/debugger/devtools-elements.common.ts index 5abfb667d..71473ef5a 100644 --- a/nativescript-core/debugger/devtools-elements.common.ts +++ b/nativescript-core/debugger/devtools-elements.common.ts @@ -4,6 +4,9 @@ import { getNodeById } from "./dom-node"; import { ViewBase } from "../ui/core/view-base"; import { mainThreadify } from "../utils/utils"; +// Use lazy requires for core modules +const getAppRootView = () => require("../application").getRootView(); + let unsetValue; function unsetViewValue(view, name) { if (!unsetValue) { @@ -24,19 +27,19 @@ function getViewById(nodeId: number): ViewBase { } export function getDocument() { - const topMostFrame = require("../ui/frame").Frame.topmost(); - if (!topMostFrame) { + const appRoot = getAppRootView(); + if (!appRoot) { return undefined; } try { - topMostFrame.ensureDomNode(); + appRoot.ensureDomNode(); } catch (e) { console.log("ERROR in getDocument(): " + e); } - return topMostFrame.domNode.toObject(); + return appRoot.domNode.toObject(); } export function getComputedStylesForNode(nodeId): Array<{ name: string, value: string }> { diff --git a/nativescript-core/ui/frame/frame.android.ts b/nativescript-core/ui/frame/frame.android.ts index 096adb628..8468ccf55 100644 --- a/nativescript-core/ui/frame/frame.android.ts +++ b/nativescript-core/ui/frame/frame.android.ts @@ -937,18 +937,21 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks { @profile public onDestroyView(fragment: org.nativescript.widgets.FragmentBase, superFunc: Function): void { - if (traceEnabled()) { - traceWrite(`${fragment}.onDestroyView()`, traceCategories.NativeLifecycle); - } + try { + if (traceEnabled()) { + traceWrite(`${fragment}.onDestroyView()`, traceCategories.NativeLifecycle); + } - const hasRemovingParent = fragment.getRemovingParentFragment(); + const hasRemovingParent = fragment.getRemovingParentFragment(); - if (hasRemovingParent) { - const bitmapDrawable = new android.graphics.drawable.BitmapDrawable(application.android.context.getResources(), this.backgroundBitmap); - this.frame.nativeViewProtected.setBackgroundDrawable(bitmapDrawable); - this.backgroundBitmap = null; + if (hasRemovingParent) { + const bitmapDrawable = new android.graphics.drawable.BitmapDrawable(application.android.context.getResources(), this.backgroundBitmap); + this.frame.nativeViewProtected.setBackgroundDrawable(bitmapDrawable); + this.backgroundBitmap = null; + } + } finally { + superFunc.call(fragment); } - superFunc.call(fragment); } @profile @@ -982,14 +985,17 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks { @profile public onPause(fragment: org.nativescript.widgets.FragmentBase, superFunc: Function): void { - // Get view as bitmap and set it as background. This is workaround for the disapearing nested fragments. - // TODO: Consider removing it when update to androidx.fragment:1.2.0 - const hasRemovingParent = fragment.getRemovingParentFragment(); + try { + // Get view as bitmap and set it as background. This is workaround for the disapearing nested fragments. + // TODO: Consider removing it when update to androidx.fragment:1.2.0 + const hasRemovingParent = fragment.getRemovingParentFragment(); - if (hasRemovingParent) { - this.backgroundBitmap = this.loadBitmapFromView(this.frame.nativeViewProtected); + if (hasRemovingParent) { + this.backgroundBitmap = this.loadBitmapFromView(this.frame.nativeViewProtected); + } + } finally { + superFunc.call(fragment); } - superFunc.call(fragment); } @profile @@ -1154,19 +1160,21 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks { @profile public onDestroy(activity: any, superFunc: Function): void { - if (traceEnabled()) { - traceWrite("NativeScriptActivity.onDestroy();", traceCategories.NativeLifecycle); + try { + if (traceEnabled()) { + traceWrite("NativeScriptActivity.onDestroy();", traceCategories.NativeLifecycle); + } + + const rootView = this._rootView; + if (rootView) { + rootView._tearDownUI(true); + } + + const exitArgs = { eventName: application.exitEvent, object: application.android, android: activity }; + application.notify(exitArgs); + } finally { + superFunc.call(activity); } - - const rootView = this._rootView; - if (rootView) { - rootView._tearDownUI(true); - } - - const exitArgs = { eventName: application.exitEvent, object: application.android, android: activity }; - application.notify(exitArgs); - - superFunc.call(activity); } @profile diff --git a/nativescript-core/ui/html-view/html-view.ios.ts b/nativescript-core/ui/html-view/html-view.ios.ts index f0cb9dcb4..3252c3626 100644 --- a/nativescript-core/ui/html-view/html-view.ios.ts +++ b/nativescript-core/ui/html-view/html-view.ios.ts @@ -1,9 +1,12 @@ import { HtmlViewBase, View, layout, htmlProperty } from "./html-view-common"; +import { ios } from "../../utils/utils"; export * from "./html-view-common"; +const majorVersion = ios.MajorVersion; + export class HtmlView extends HtmlViewBase { nativeViewProtected: UITextView; @@ -50,6 +53,14 @@ export class HtmlView extends HtmlViewBase { [htmlProperty.setNative](value: string) { const htmlString = NSString.stringWithString(value + ""); const nsData = htmlString.dataUsingEncoding(NSUnicodeStringEncoding); - this.nativeViewProtected.attributedText = NSAttributedString.alloc().initWithDataOptionsDocumentAttributesError(nsData, { [NSDocumentTypeDocumentAttribute]: NSHTMLTextDocumentType }, null); + this.nativeViewProtected.attributedText = NSAttributedString.alloc().initWithDataOptionsDocumentAttributesError( + nsData, + { [NSDocumentTypeDocumentAttribute]: NSHTMLTextDocumentType }, + null + ); + + if (majorVersion >= 13) { + this.nativeViewProtected.textColor = UIColor.labelColor; + } } } diff --git a/nativescript-core/ui/text-base/text-base.ios.ts b/nativescript-core/ui/text-base/text-base.ios.ts index c7c07218b..4665757c0 100644 --- a/nativescript-core/ui/text-base/text-base.ios.ts +++ b/nativescript-core/ui/text-base/text-base.ios.ts @@ -153,6 +153,10 @@ export class TextBase extends TextBaseCommon { this.nativeTextViewProtected.setAttributedTitleForState(attrText, UIControlState.Normal); } else { + if (majorVersion >= 13) { + this.nativeTextViewProtected.textColor = UIColor.labelColor; + } + this.nativeTextViewProtected.attributedText = attrText; } }