diff --git a/apps/.vscode/launch.json b/apps/.vscode/launch.json index abcaa7450..a04635572 100644 --- a/apps/.vscode/launch.json +++ b/apps/.vscode/launch.json @@ -8,7 +8,10 @@ "platform": "ios", "appRoot": "${workspaceRoot}", "sourceMaps": true, - "watch": true + "watch": true, + "tnsArgs": [ + "--sync-all-files" + ] }, { "name": "Attach on iOS", @@ -26,7 +29,10 @@ "platform": "android", "appRoot": "${workspaceRoot}", "sourceMaps": true, - "watch": true + "watch": true, + "tnsArgs": [ + "--sync-all-files" + ] }, { "name": "Attach on Android", diff --git a/tns-core-modules/ui/tab-view/tab-view-common.ts b/tns-core-modules/ui/tab-view/tab-view-common.ts index 8861a607a..a246ffbaf 100644 --- a/tns-core-modules/ui/tab-view/tab-view-common.ts +++ b/tns-core-modules/ui/tab-view/tab-view-common.ts @@ -196,7 +196,6 @@ selectedIndexProperty.register(TabViewBase); export const itemsProperty = new Property({ name: "items", valueChanged: (target, oldValue, newValue) => { target.onItemsChanged(oldValue, newValue); - selectedIndexProperty.coerce(target); } }); itemsProperty.register(TabViewBase); 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 9ccd8e675..915fb32c3 100644 --- a/tns-core-modules/ui/tab-view/tab-view.android.ts +++ b/tns-core-modules/ui/tab-view/tab-view.android.ts @@ -327,25 +327,21 @@ export class TabView extends TabViewBase { } public disposeNativeView() { - // this._tabLayout.setItems(null, null); this._pagerAdapter.notifyDataSetChanged(); (this._pagerAdapter).owner = null; this._pagerAdapter = null; - // this._viewPager.setAdapter(null); this._tabLayout = null; (this._viewPager).listener.owner = null; this._viewPager = null; super.disposeNativeView(); } - private setAdapter(items: Array) { + private setAdapterItems(items: Array) { (this._pagerAdapter).items = items; const length = items ? items.length : 0; if (length === 0) { - // this._viewPager.setAdapter(null); - // this._pagerAdapter = null; this._tabLayout.setItems(null, null); return; } @@ -393,7 +389,8 @@ export class TabView extends TabViewBase { return null; } [itemsProperty.setNative](value: TabViewItem[]) { - this.setAdapter(value); + this.setAdapterItems(value); + selectedIndexProperty.coerce(this); } [tabBackgroundColorProperty.getDefault](): android.graphics.drawable.Drawable.ConstantState { diff --git a/tns-core-modules/ui/tab-view/tab-view.ios.ts b/tns-core-modules/ui/tab-view/tab-view.ios.ts index a847e7a7f..dcec88431 100644 --- a/tns-core-modules/ui/tab-view/tab-view.ios.ts +++ b/tns-core-modules/ui/tab-view/tab-view.ios.ts @@ -386,6 +386,7 @@ export class TabView extends TabViewBase { } [itemsProperty.setNative](value: TabViewItem[]) { this.setViewControllers(value); + selectedIndexProperty.coerce(this); } [tabTextColorProperty.getDefault](): UIColor { 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 be0c822e7..a84c5c7bd 100644 --- a/tns-core-modules/ui/text-base/text-base.ios.ts +++ b/tns-core-modules/ui/text-base/text-base.ios.ts @@ -42,13 +42,12 @@ export class TextBase extends TextBaseCommon { } [colorProperty.setNative](value: Color | UIColor) { const color = value instanceof Color ? value.ios : value; - if (!this.formattedText) { - let nativeView = this.nativeView; - if (nativeView instanceof UIButton) { - nativeView.setTitleColorForState(color, UIControlState.Normal); - } else { - nativeView.textColor = color; - } + const nativeView = this.nativeView; + if (nativeView instanceof UIButton) { + nativeView.setTitleColorForState(color, UIControlState.Normal); + nativeView.titleLabel.textColor = color; + } else { + nativeView.textColor = color; } } @@ -58,10 +57,10 @@ export class TextBase extends TextBaseCommon { return nativeView.font; } [fontInternalProperty.setNative](value: Font | UIFont) { - if (!this.formattedText) { + if (!(value instanceof Font) || !this.formattedText) { let nativeView = this.nativeView; nativeView = nativeView instanceof UIButton ? nativeView.titleLabel : nativeView; - let font = value instanceof Font ? value.getUIFont(nativeView.font) : value; + const font = value instanceof Font ? value.getUIFont(nativeView.font) : value; nativeView.font = font; } } @@ -170,14 +169,14 @@ export class TextBase extends TextBaseCommon { dict.set(NSKernAttributeName, style.letterSpacing * this.nativeView.font.pointSize); } - if (style.color) { + const isTextView = this.nativeView instanceof UITextView; + if (style.color && (dict.size > 0 || isTextView)) { dict.set(NSForegroundColorAttributeName, style.color.ios); } const text = this.text; const string = (text === undefined || text === null) ? '' : text.toString(); const source = getTransformedText(string, this.textTransform); - const isTextView = this.nativeView instanceof UITextView; if (dict.size > 0 || isTextView) { if (isTextView) { // UITextView's font seems to change inside.