mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
feat: add background color css to tab strip (#7414)
This commit is contained in:
@@ -3,13 +3,15 @@
|
||||
* @module "ui/tab-navigation/tab-strip"
|
||||
*/ /** */
|
||||
|
||||
import { ViewBase, Property } from "../../core/view";
|
||||
import { View, Property } from "../../core/view";
|
||||
import { Color } from "../../../color";
|
||||
import { TabStripItem } from "../tab-strip-item";
|
||||
|
||||
/**
|
||||
* Represents a tab strip.
|
||||
*/
|
||||
export class TabStrip extends ViewBase {
|
||||
export class TabStrip extends View {
|
||||
|
||||
/**
|
||||
* Gets or sets the items of the tab strip.
|
||||
*/
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
// Types
|
||||
// Types
|
||||
import { TabStrip as TabStripDefinition } from ".";
|
||||
import { TabStripItem } from "../tab-strip-item";
|
||||
import { TabNavigationBase } from "../tab-navigation-base";
|
||||
import { Color } from "../../../color";
|
||||
import { AddArrayFromBuilder, AddChildFromBuilder } from "../../core/view";
|
||||
|
||||
// Requires
|
||||
import { ViewBase, Property, CSSType } from "../../core/view";
|
||||
import { View, Property, CSSType, backgroundColorProperty, backgroundInternalProperty } from "../../core/view";
|
||||
|
||||
export const traceCategory = "TabView";
|
||||
|
||||
@CSSType("TabStrip")
|
||||
export class TabStrip extends ViewBase implements TabStripDefinition, AddChildFromBuilder, AddArrayFromBuilder {
|
||||
export class TabStrip extends View implements TabStripDefinition, AddChildFromBuilder, AddArrayFromBuilder {
|
||||
public items: TabStripItem[];
|
||||
public iosIconRenderingMode: "automatic" | "alwaysOriginal" | "alwaysTemplate";
|
||||
|
||||
@@ -29,7 +31,25 @@ export class TabStrip extends ViewBase implements TabStripDefinition, AddChildFr
|
||||
// selectedIndexProperty.coerce(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[backgroundColorProperty.getDefault](): Color {
|
||||
const parent = <TabNavigationBase>this.parent;
|
||||
|
||||
return parent && parent.getTabBarBackgroundColor();
|
||||
}
|
||||
[backgroundColorProperty.setNative](value: Color) {
|
||||
const parent = <TabNavigationBase>this.parent;
|
||||
|
||||
return parent && parent.setTabBarBackgroundColor(value);
|
||||
}
|
||||
|
||||
[backgroundInternalProperty.getDefault](): any {
|
||||
return null;
|
||||
}
|
||||
[backgroundInternalProperty.setNative](value: any) {
|
||||
// disable the background CSS properties
|
||||
}
|
||||
}
|
||||
|
||||
export const iosIconRenderingModeProperty = new Property<TabStrip, "automatic" | "alwaysOriginal" | "alwaysTemplate">({ name: "iosIconRenderingMode", defaultValue: "automatic" });
|
||||
iosIconRenderingModeProperty.register(TabStrip);
|
||||
|
||||
Reference in New Issue
Block a user