diff --git a/CHANGELOG.md b/CHANGELOG.md index e6a659ae6..0537ba975 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,30 @@ + +# [5.4.0](https://github.com/NativeScript/NativeScript/compare/5.3.2...5.4.0) (2019-05-14) + + +### Bug Fixes + +* throw if failed to load component ([#7186](https://github.com/NativeScript/NativeScript/issues/7186)) ([b7abb3d](https://github.com/NativeScript/NativeScript/commit/b7abb3d)) +* **android/button:** possible incorrect button visual state ([#7190](https://github.com/NativeScript/NativeScript/issues/7190)) ([2a02360](https://github.com/NativeScript/NativeScript/commit/2a02360)) +* **devtools-ios:** Ensure UI modifications run on main thread ([c60f74d](https://github.com/NativeScript/NativeScript/commit/c60f74d)), closes [#7219](https://github.com/NativeScript/NativeScript/issues/7219) +* **ios:** add null check to TouchGestureRecognizer ([#7182](https://github.com/NativeScript/NativeScript/issues/7182)) ([7d3f0d9](https://github.com/NativeScript/NativeScript/commit/7d3f0d9)) +* **ios:** application.displayedEvent does not depend on trace to fire ([#7141](https://github.com/NativeScript/NativeScript/issues/7141)) ([#7156](https://github.com/NativeScript/NativeScript/issues/7156)) ([4e56c89](https://github.com/NativeScript/NativeScript/commit/4e56c89)) +* **ios:** image cache module not longer sets null in NSCache ([#7171](https://github.com/NativeScript/NativeScript/issues/7171)) ([4f79d2e](https://github.com/NativeScript/NativeScript/commit/4f79d2e)) +* **ios-modal:** closeCallback not being called with popover presentation style ([#7189](https://github.com/NativeScript/NativeScript/issues/7189)) ([aa44eb9](https://github.com/NativeScript/NativeScript/commit/aa44eb9)) +* **ios-tabview:** crash when setting tab text color ([#7188](https://github.com/NativeScript/NativeScript/issues/7188)) ([77c45da](https://github.com/NativeScript/NativeScript/commit/77c45da)) +* **text:** crash when removing FormattedText ([#7237](https://github.com/NativeScript/NativeScript/issues/7237)) ([37b53c6](https://github.com/NativeScript/NativeScript/commit/37b53c6)) + + +### Features + +* **android:** elevation shadow support ([#7136](https://github.com/NativeScript/NativeScript/issues/7136)) ([cf533a7](https://github.com/NativeScript/NativeScript/commit/cf533a7)) +* **android:** implement a 'activityNewIntent' event ([3efc06e](https://github.com/NativeScript/NativeScript/commit/3efc06e)) +* **android:** implement BorderDrawable outline ([ec07a99](https://github.com/NativeScript/NativeScript/commit/ec07a99)) +* **hmr:** preserve navigation history on applying changes ([#7146](https://github.com/NativeScript/NativeScript/issues/7146)) ([d35e14e](https://github.com/NativeScript/NativeScript/commit/d35e14e)) +* **switch:** add property for off state background color ([#7138](https://github.com/NativeScript/NativeScript/issues/7138)) ([f0146f0](https://github.com/NativeScript/NativeScript/commit/f0146f0)) + + + ## [5.3.2](https://github.com/NativeScript/NativeScript/compare/5.3.1...5.3.2) (2019-05-03) diff --git a/tests/app/ui/label/label-tests.ts b/tests/app/ui/label/label-tests.ts index 5063e903f..6e4f416af 100644 --- a/tests/app/ui/label/label-tests.ts +++ b/tests/app/ui/label/label-tests.ts @@ -162,10 +162,10 @@ export class LabelTest extends testModule.UITest { const span = new Span(); span.text = "long label"; span.fontWeight = "bold"; - + const span2 = new Span(); span2.text = "long label"; - + const formattedString = new FormattedString(); formattedString.spans.push(span); formattedString.spans.push(span2); @@ -176,7 +176,7 @@ export class LabelTest extends testModule.UITest { const span3 = new Span(); span3.text = "short label"; span3.fontWeight = "bold"; - + const formattedString2 = new FormattedString(); formattedString2.spans.push(span3); label.formattedText = formattedString2; @@ -210,7 +210,7 @@ export class LabelTest extends testModule.UITest { const span = new Span(); span.text = "short label"; span.fontWeight = "bold"; - + const formattedString = new FormattedString(); formattedString.spans.push(span); label.formattedText = formattedString; @@ -220,10 +220,10 @@ export class LabelTest extends testModule.UITest { const span2 = new Span(); span2.text = "long label"; span2.fontWeight = "bold"; - + const span3 = new Span(); span3.text = "long label"; - + const formattedString2 = new FormattedString(); formattedString2.spans.push(span2); formattedString2.spans.push(span3); @@ -733,6 +733,21 @@ export class LabelTest extends testModule.UITest { return host; }); } + + public test_FormattedText_ShouldNotCrash_WheRemovedFromSpan() { + const label = this.testView; + label.color = new colorModule.Color("red"); + this.waitUntilTestElementIsLoaded(); + + const span = new Span(); + span.text = "test"; + + const formattedString = new FormattedString(); + formattedString.spans.push(span); + + label._addChildFromBuilder("FormattedString", formattedString); + label._removeView(formattedString); + }; } export function createTestCase(): LabelTest { diff --git a/tns-core-modules/ui/text-base/text-base.android.ts b/tns-core-modules/ui/text-base/text-base.android.ts index 4dfd0d45f..9ae4eb367 100644 --- a/tns-core-modules/ui/text-base/text-base.android.ts +++ b/tns-core-modules/ui/text-base/text-base.android.ts @@ -12,7 +12,7 @@ import { isString } from "../../utils/types"; export * from "./text-base-common"; interface TextTransformation { - new (owner: TextBase): android.text.method.TransformationMethod; + new(owner: TextBase): android.text.method.TransformationMethod; } let TextTransformation: TextTransformation; @@ -344,7 +344,7 @@ export function getTransformedText(text: string, textTransform: TextTransform): } function createSpannableStringBuilder(formattedString: FormattedString): android.text.SpannableStringBuilder { - if (!formattedString) { + if (!formattedString || !formattedString.parent) { return null; } diff --git a/tns-core-modules/ui/text-base/text-base.ios.ts b/tns-core-modules/ui/text-base/text-base.ios.ts index e9303a108..69c2c1bcf 100644 --- a/tns-core-modules/ui/text-base/text-base.ios.ts +++ b/tns-core-modules/ui/text-base/text-base.ios.ts @@ -231,7 +231,7 @@ export class TextBase extends TextBaseCommon { createNSMutableAttributedString(formattedString: FormattedString): NSMutableAttributedString { let mas = NSMutableAttributedString.alloc().init(); - if (formattedString) { + if (formattedString && formattedString.parent) { for (let i = 0, spanStart = 0, length = formattedString.spans.length; i < length; i++) { const span = formattedString.spans.getItem(i); const text = span.text;