mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 19:26:42 +08:00
fix: return default tab background color when the background color is not explicitely set through css (#8240)
* fix: return default tab background color when the background color is not explicitely set through css * chore: update NativeScript.api.md * fix: do not cast return getTabBarBackgroundColor to ColorDrawable * chore: added comment and method check Co-authored-by: Alexander Vakrilov <alexander.vakrilov@gmail.com>
This commit is contained in:
@ -2197,6 +2197,8 @@ export class TabContentItem extends ContentView {
|
|||||||
export class TabNavigationBase extends View {
|
export class TabNavigationBase extends View {
|
||||||
android: any /* android.view.View */;
|
android: any /* android.view.View */;
|
||||||
|
|
||||||
|
getTabBarBackgroundArgbColor(): any
|
||||||
|
|
||||||
getTabBarBackgroundColor(): any
|
getTabBarBackgroundColor(): any
|
||||||
|
|
||||||
getTabBarColor(): any
|
getTabBarColor(): any
|
||||||
|
@ -578,9 +578,7 @@ export class BottomNavigation extends TabNavigationBase {
|
|||||||
|
|
||||||
// BACKGROUND-COLOR
|
// BACKGROUND-COLOR
|
||||||
const backgroundColor = tabStripItem.style.backgroundColor;
|
const backgroundColor = tabStripItem.style.backgroundColor;
|
||||||
if (backgroundColor) {
|
tabItemSpec.backgroundColor = backgroundColor ? backgroundColor.android : this.getTabBarBackgroundArgbColor();
|
||||||
tabItemSpec.backgroundColor = backgroundColor.android;
|
|
||||||
}
|
|
||||||
|
|
||||||
// COLOR
|
// COLOR
|
||||||
const color = titleLabel.style.color;
|
const color = titleLabel.style.color;
|
||||||
|
@ -90,6 +90,12 @@ export class TabNavigationBase extends View {
|
|||||||
*/
|
*/
|
||||||
getTabBarBackgroundColor(): any
|
getTabBarBackgroundColor(): any
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* Method is intended to be overridden by inheritors and used as "protected"
|
||||||
|
*/
|
||||||
|
getTabBarBackgroundArgbColor(): any
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* Method is intended to be overridden by inheritors and used as "protected"
|
* Method is intended to be overridden by inheritors and used as "protected"
|
||||||
|
@ -113,6 +113,13 @@ export class TabNavigationBase extends View implements TabNavigationBaseDefiniti
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getTabBarBackgroundArgbColor(): any {
|
||||||
|
// This method is implemented only for Android
|
||||||
|
const colorDrawable = this.getTabBarBackgroundColor();
|
||||||
|
|
||||||
|
return colorDrawable && colorDrawable.getColor && colorDrawable.getColor();
|
||||||
|
}
|
||||||
|
|
||||||
public setTabBarBackgroundColor(value: any): void {
|
public setTabBarBackgroundColor(value: any): void {
|
||||||
// overridden by inheritors
|
// overridden by inheritors
|
||||||
}
|
}
|
||||||
|
@ -653,9 +653,7 @@ export class Tabs extends TabsBase {
|
|||||||
|
|
||||||
// BACKGROUND-COLOR
|
// BACKGROUND-COLOR
|
||||||
const backgroundColor = tabStripItem.style.backgroundColor;
|
const backgroundColor = tabStripItem.style.backgroundColor;
|
||||||
if (backgroundColor) {
|
tabItemSpec.backgroundColor = backgroundColor ? backgroundColor.android : this.getTabBarBackgroundArgbColor();
|
||||||
tabItemSpec.backgroundColor = backgroundColor.android;
|
|
||||||
}
|
|
||||||
|
|
||||||
// COLOR
|
// COLOR
|
||||||
const color = nestedLabel.style.color;
|
const color = nestedLabel.style.color;
|
||||||
|
Reference in New Issue
Block a user