diff --git a/CHANGELOG.md b/CHANGELOG.md index a7658cf84..e72aaab8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,16 @@ +## [6.2.2](https://github.com/NativeScript/NativeScript/compare/6.2.1...6.2.2) (2019-11-25) + + +### Bug Fixes + +* **android:** Fatal Exception: java.lang.OutOfMemoryError ([#8061](https://github.com/NativeScript/NativeScript/issues/8061)) ([#8098](https://github.com/NativeScript/NativeScript/issues/8098)) ([bca1271](https://github.com/NativeScript/NativeScript/commit/bca1271)) +* **frame:** nested frame wrong background after parent navigation ([#8095](https://github.com/NativeScript/NativeScript/issues/8095)) ([d983f79](https://github.com/NativeScript/NativeScript/commit/d983f79)) +* tab navigations don't work with lowercase xml ([#8016](https://github.com/NativeScript/NativeScript/issues/8016)) ([800f5bc](https://github.com/NativeScript/NativeScript/commit/800f5bc)) +* **frame:** push recreated frame back in frameStack when Don't Keep Activities enabled ([#8096](https://github.com/NativeScript/NativeScript/issues/8096)) ([47f4c25](https://github.com/NativeScript/NativeScript/commit/47f4c25)) +* **iOS:** check for iOS 13 APIs ([#8093](https://github.com/NativeScript/NativeScript/issues/8093)) ([b069ff3](https://github.com/NativeScript/NativeScript/commit/b069ff3)) + + + ## [6.2.1](https://github.com/NativeScript/NativeScript/compare/6.2.0...6.2.1) (2019-11-12) diff --git a/nativescript-core/application/application.ios.ts b/nativescript-core/application/application.ios.ts index 349513ddf..f156cda3d 100644 --- a/nativescript-core/application/application.ios.ts +++ b/nativescript-core/application/application.ios.ts @@ -93,7 +93,7 @@ class CADisplayLinkTarget extends NSObject { /* tslint:disable */ export class iOSApplication implements iOSApplicationDefinition { /* tslint:enable */ - private _backgroundColor = majorVersion <= 12 ? UIColor.whiteColor : UIColor.systemBackgroundColor; + private _backgroundColor = (majorVersion <= 12 || !UIColor.systemBackgroundColor) ? UIColor.whiteColor : UIColor.systemBackgroundColor; private _delegate: typeof UIApplicationDelegate; private _window: UIWindow; private _observers: Array; @@ -125,7 +125,6 @@ export class iOSApplication implements iOSApplicationDefinition { } get systemAppearance(): "light" | "dark" | null { - // userInterfaceStyle is available on UITraitCollection since iOS 12. if (majorVersion <= 11) { return null; diff --git a/nativescript-core/ui/activity-indicator/activity-indicator.ios.ts b/nativescript-core/ui/activity-indicator/activity-indicator.ios.ts index 9ce1dfb51..153e45673 100644 --- a/nativescript-core/ui/activity-indicator/activity-indicator.ios.ts +++ b/nativescript-core/ui/activity-indicator/activity-indicator.ios.ts @@ -9,7 +9,7 @@ const majorVersion = ios.MajorVersion; export class ActivityIndicator extends ActivityIndicatorBase { nativeViewProtected: UIActivityIndicatorView; - private _activityIndicatorViewStyle = majorVersion <= 12 ? UIActivityIndicatorViewStyle.Gray : UIActivityIndicatorViewStyle.Medium; + private _activityIndicatorViewStyle = (majorVersion <= 12 || !UIActivityIndicatorViewStyle.Medium) ? UIActivityIndicatorViewStyle.Gray : UIActivityIndicatorViewStyle.Medium; createNativeView() { const viewStyle = this._activityIndicatorViewStyle; diff --git a/nativescript-core/ui/bottom-navigation/bottom-navigation.ios.ts b/nativescript-core/ui/bottom-navigation/bottom-navigation.ios.ts index b5e06d67a..f94154dfc 100644 --- a/nativescript-core/ui/bottom-navigation/bottom-navigation.ios.ts +++ b/nativescript-core/ui/bottom-navigation/bottom-navigation.ios.ts @@ -93,7 +93,9 @@ class UITabBarControllerImpl extends UITabBarController { if (majorVersion >= 13) { const owner = this._owner.get(); - if (owner && this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection(previousTraitCollection)) { + if (owner && + this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection && + this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection(previousTraitCollection)) { owner.notify({ eventName: iosView.traitCollectionColorAppearanceChangedEvent, object: owner }); } } diff --git a/nativescript-core/ui/core/view/view-helper/view-helper.ios.ts b/nativescript-core/ui/core/view/view-helper/view-helper.ios.ts index 99a8e9838..b52f28620 100644 --- a/nativescript-core/ui/core/view/view-helper/view-helper.ios.ts +++ b/nativescript-core/ui/core/view/view-helper/view-helper.ios.ts @@ -312,7 +312,9 @@ export namespace ios { if (majorVersion >= 13) { const owner = this.owner.get(); - if (owner && this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection(previousTraitCollection)) { + if (owner && + this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection && + this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection(previousTraitCollection)) { owner.notify({ eventName: traitCollectionColorAppearanceChangedEvent, object: owner }); } } diff --git a/nativescript-core/ui/frame/frame-common.ts b/nativescript-core/ui/frame/frame-common.ts index fbb4e67ac..7abe9f168 100644 --- a/nativescript-core/ui/frame/frame-common.ts +++ b/nativescript-core/ui/frame/frame-common.ts @@ -59,12 +59,12 @@ export class FrameBase extends CustomLayoutView implements FrameDefinition { const top = FrameBase.topmost(); if (top && top.canGoBack()) { top.goBack(); - + return true; } else if (top) { let parentFrameCanGoBack = false; let parentFrame = getAncestor(top, "Frame"); - + while (parentFrame && !parentFrameCanGoBack) { if (parentFrame && parentFrame.canGoBack()) { parentFrameCanGoBack = true; @@ -72,18 +72,18 @@ export class FrameBase extends CustomLayoutView implements FrameDefinition { parentFrame = getAncestor(parentFrame, "Frame"); } } - + if (parentFrame && parentFrameCanGoBack) { parentFrame.goBack(); - + return true; } } - + if (frameStack.length > 1) { top._popFromFrameStack(); } - + return false; } @@ -205,11 +205,11 @@ export class FrameBase extends CustomLayoutView implements FrameDefinition { traceWrite(`NAVIGATE`, traceCategories.Navigation); } + this._pushInFrameStack(); + const entry = buildEntryFromArgs(param); const page = Builder.createViewFromEntry(entry) as Page; - this._pushInFrameStack(); - const backstackEntry: BackstackEntry = { entry: entry, resolvedPage: page, diff --git a/nativescript-core/ui/frame/frame.android.ts b/nativescript-core/ui/frame/frame.android.ts index e78eddb63..e06248e64 100644 --- a/nativescript-core/ui/frame/frame.android.ts +++ b/nativescript-core/ui/frame/frame.android.ts @@ -11,7 +11,7 @@ import * as application from "../../application"; import { _stack, FrameBase, NavigationType, Observable, - traceCategories, traceEnabled, traceError, traceWrite, View + traceCategories, traceEnabled, traceError, traceWrite, View, Color } from "./frame-common"; import { @@ -88,6 +88,7 @@ function getAttachListener(): android.view.View.OnAttachStateChangeListener { } export class Frame extends FrameBase { + public _originalBackground: any; private _android: AndroidFrame; private _containerViewId: number = -1; private _tearDownPending = false; @@ -238,6 +239,16 @@ export class Frame extends FrameBase { this.disposeCurrentFragment(); } + onLoaded(): void { + if (this._originalBackground) { + this.backgroundColor = null; + this.backgroundColor = this._originalBackground; + this._originalBackground = null; + } + + super.onLoaded(); + } + onUnloaded() { super.onUnloaded(); @@ -471,6 +482,13 @@ export class Frame extends FrameBase { } public createNativeView() { + // Create native view with available _currentEntry occur in Don't Keep Activities + // scenario when Activity is recreated on app suspend/resume. Push frame back in frame stack + // since it was removed in disposeNativeView() method. + if (this._currentEntry) { + this._pushInFrameStack(); + } + return new org.nativescript.widgets.ContentLayout(this._context); } @@ -945,6 +963,7 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks { if (hasRemovingParent) { const bitmapDrawable = new android.graphics.drawable.BitmapDrawable(application.android.context.getResources(), this.backgroundBitmap); + this.frame._originalBackground = this.frame.backgroundColor || new Color("White"); this.frame.nativeViewProtected.setBackgroundDrawable(bitmapDrawable); this.backgroundBitmap = null; } diff --git a/nativescript-core/ui/frame/frame.ios.ts b/nativescript-core/ui/frame/frame.ios.ts index f31b12b93..774c67c00 100644 --- a/nativescript-core/ui/frame/frame.ios.ts +++ b/nativescript-core/ui/frame/frame.ios.ts @@ -541,7 +541,9 @@ class UINavigationControllerImpl extends UINavigationController { if (majorVersion >= 13) { const owner = this._owner.get(); - if (owner && this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection(previousTraitCollection)) { + if (owner && + this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection && + this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection(previousTraitCollection)) { owner.notify({ eventName: iosViewHelper.traitCollectionColorAppearanceChangedEvent, object: owner }); } } diff --git a/nativescript-core/ui/html-view/html-view.ios.ts b/nativescript-core/ui/html-view/html-view.ios.ts index 3252c3626..d5c1d5b6e 100644 --- a/nativescript-core/ui/html-view/html-view.ios.ts +++ b/nativescript-core/ui/html-view/html-view.ios.ts @@ -59,7 +59,7 @@ export class HtmlView extends HtmlViewBase { null ); - if (majorVersion >= 13) { + if (majorVersion >= 13 && UIColor.labelColor) { this.nativeViewProtected.textColor = UIColor.labelColor; } } diff --git a/nativescript-core/ui/page/page.ios.ts b/nativescript-core/ui/page/page.ios.ts index 4fd9a4fc3..d54cdf649 100644 --- a/nativescript-core/ui/page/page.ios.ts +++ b/nativescript-core/ui/page/page.ios.ts @@ -287,7 +287,9 @@ class UIViewControllerImpl extends UIViewController { if (majorVersion >= 13) { const owner = this._owner.get(); - if (owner && this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection(previousTraitCollection)) { + if (owner && + this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection && + this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection(previousTraitCollection)) { owner.notify({ eventName: iosView.traitCollectionColorAppearanceChangedEvent, object: owner }); } } @@ -298,7 +300,7 @@ export class Page extends PageBase { nativeViewProtected: UIView; viewController: UIViewControllerImpl; - private _backgroundColor = majorVersion <= 12 ? UIColor.whiteColor : UIColor.systemBackgroundColor; + private _backgroundColor = (majorVersion <= 12 && !UIColor.systemBackgroundColor) ? UIColor.whiteColor : UIColor.systemBackgroundColor; private _ios: UIViewControllerImpl; public _presentedViewController: UIViewController; // used when our page present native viewController without going through our abstraction. diff --git a/nativescript-core/ui/tab-navigation-base/tab-navigation-base/tab-navigation-base.ts b/nativescript-core/ui/tab-navigation-base/tab-navigation-base/tab-navigation-base.ts index ddd1429de..eb8d96ed0 100644 --- a/nativescript-core/ui/tab-navigation-base/tab-navigation-base/tab-navigation-base.ts +++ b/nativescript-core/ui/tab-navigation-base/tab-navigation-base/tab-navigation-base.ts @@ -1,12 +1,12 @@ // Types import { TabNavigationBase as TabNavigationBaseDefinition, SelectedIndexChangedEventData } from "."; -import { TabContentItem } from "../tab-content-item"; -import { TabStrip } from "../tab-strip"; import { TabStripItem } from "../tab-strip-item"; import { ViewBase, AddArrayFromBuilder, AddChildFromBuilder, EventData } from "../../core/view"; // Requires -import { View, Property, CoercibleProperty, isIOS, Color } from "../../core/view"; +import { View, Property, CoercibleProperty, isIOS } from "../../core/view"; +import { TabContentItem } from "../tab-content-item"; +import { TabStrip } from "../tab-strip"; // TODO: Impl trace // export const traceCategory = "TabView"; @@ -29,14 +29,14 @@ export class TabNavigationBase extends View implements TabNavigationBaseDefiniti } public _addChildFromBuilder(name: string, value: any): void { - if (name === "TabContentItem") { + if (value instanceof TabContentItem) { if (!this.items) { this.items = new Array(); } this.items.push(value); this._addView(value); // selectedIndexProperty.coerce(this); - } else if (name === "TabStrip") { + } else if (value instanceof TabStrip) { // Setting tabStrip will trigger onTabStripChanged this.tabStrip = value; } diff --git a/nativescript-core/ui/tab-navigation-base/tab-strip-item/tab-strip-item.ts b/nativescript-core/ui/tab-navigation-base/tab-strip-item/tab-strip-item.ts index 10d846c7e..bab24db82 100644 --- a/nativescript-core/ui/tab-navigation-base/tab-strip-item/tab-strip-item.ts +++ b/nativescript-core/ui/tab-navigation-base/tab-strip-item/tab-strip-item.ts @@ -3,8 +3,6 @@ import { TabStripItem as TabStripItemDefinition } from "."; import { PropertyChangeData } from "../../../data/observable"; import { TabNavigationBase } from "../tab-navigation-base"; import { TabStrip } from "../tab-strip"; -import { Image } from "../../image/image"; -import { Label } from "../../label/label"; import { Color } from "../../../color"; import { AddChildFromBuilder } from "../../core/view"; @@ -12,8 +10,9 @@ import { AddChildFromBuilder } from "../../core/view"; import { View, ViewBase, CSSType, backgroundColorProperty, backgroundInternalProperty, PseudoClassHandler } from "../../core/view"; -import { Tabs } from "../../tabs"; import { isIOS } from "../../../platform"; +import { Image } from "../../image/image"; +import { Label } from "../../label/label"; export * from "../../core/view"; export const traceCategory = "TabView"; @@ -173,14 +172,14 @@ export class TabStripItem extends View implements TabStripItemDefinition, AddChi } public _addChildFromBuilder(name: string, value: any): void { - if (name === "Image") { + if (value instanceof Image) { this.image = value; this.iconSource = (value).src; this._addView(value); // selectedIndexProperty.coerce(this); } - if (name === "Label") { + if (value instanceof Label) { this.label =