fix: dont default to Font.default (#8401)

* fix: dont default to Font.default

This would cause a font to be set for any label even when using default system font.
This will also cause a typeface which is pretty long

* lint: lint fixes

* fix: added null font guards

* fix: Used default bold for TabView

Co-authored-by: Vasko <v.trifonov@gmail.com>
This commit is contained in:
Martin Guillon
2020-04-03 15:40:14 +02:00
committed by GitHub
parent 56f6626891
commit ad9daa825f
12 changed files with 32 additions and 26 deletions

View File

@@ -1,4 +1,5 @@
import tabViewModule = require("@nativescript/core/ui/tab-view");
import { Font } from "@nativescript/core/ui/styling/font";
export function getNativeTabCount(tabView: tabViewModule.TabView): number {
if (!tabView.ios.viewControllers) {
@@ -30,5 +31,5 @@ export function getNativeFont(tabView: tabViewModule.TabView): UIFont {
}
export function getOriginalFont(tabView: tabViewModule.TabView): UIFont {
return tabView.style.fontInternal.getUIFont(UIFont.systemFontOfSize(10));
return (tabView.style.fontInternal || Font.default).getUIFont(UIFont.systemFontOfSize(10));
}

View File

@@ -1,4 +1,5 @@
import tabViewModule = require("@nativescript/core/ui/tab-view");
import { Font } from "@nativescript/core/ui/styling/font";
export function getNativeTabCount(tabView: tabViewModule.TabView): number {
if (!tabView.ios.viewControllers) {
@@ -30,5 +31,5 @@ export function getNativeFont(tabView: tabViewModule.TabView): UIFont {
}
export function getOriginalFont(tabView: tabViewModule.TabView): UIFont {
return tabView.style.fontInternal.getUIFont(UIFont.systemFontOfSize(10));
return (tabView.style.fontInternal || Font.default).getUIFont(UIFont.systemFontOfSize(10));
}

View File

@@ -1,4 +1,5 @@
import { Tabs } from "@nativescript/core/ui/tabs";
import { Font } from "@nativescript/core/ui/styling/font";
// TODO: Should we add getCount to UIPageViewController???
export function getNativeTabCount(tabView: Tabs): number {
@@ -39,5 +40,5 @@ export function getNativeFont(tabView: Tabs): UIFont {
}
export function getOriginalFont(tabView: Tabs): UIFont {
return tabView.style.fontInternal.getUIFont(UIFont.systemFontOfSize(10));
return (tabView.style.fontInternal || Font.default).getUIFont(UIFont.systemFontOfSize(10));
}