Skip to content

Commit 270988d

Browse files
authored
Added iconClass property to TabStripItem (NativeScript#8440)
* chore: ignore e2e folder's other subfolders * feat: added iconClass to tabStripItem
1 parent 243dc98 commit 270988d

File tree

4 files changed

+36
-1
lines changed

4 files changed

+36
-1
lines changed

.gitignore

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,15 @@ nativescript-core/css/system-classes.js*
6969
!nativescript-core/build/**/*.*
7070

7171
#generated by api-extractor
72-
nativescript-core/nativescript-core.d.ts
72+
nativescript-core/nativescript-core.d.ts
7373

7474
.vs/
75+
e2e/
76+
!e2e/animation
77+
!e2e/config
78+
!e2e/cuteness.io
79+
!e2e/file-qualifiers
80+
!e2e/modal-navigation
81+
!e2e/nested-frame-navigation
82+
!e2e/scoped-packages
83+
!e2e/ui-tests-app

api-reports/NativeScript.api.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2336,6 +2336,8 @@ export class TabStrip extends View {
23362336

23372337
// @public
23382338
export class TabStripItem extends View {
2339+
iconClass: string;
2340+
23392341
iconSource: string;
23402342

23412343
image: Image;

nativescript-core/ui/tab-navigation-base/tab-strip-item/tab-strip-item.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ export class TabStripItem extends View {
1616
*/
1717
title: string;
1818

19+
/**
20+
* Gets or sets the CSS class name of the icon in the tab strip entry.
21+
*/
22+
iconClass: string;
23+
1924
/**
2025
* Gets or sets the icon source of the tab strip entry.
2126
*/

nativescript-core/ui/tab-navigation-base/tab-strip-item/tab-strip-item.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export class TabStripItem extends View implements TabStripItemDefinition, AddChi
3030

3131
private _title: string;
3232
private _iconSource: string;
33+
private _iconClass: string;
3334

3435
private _highlightedHandler: () => void;
3536
private _normalHandler: () => void;
@@ -59,6 +60,22 @@ export class TabStripItem extends View implements TabStripItemDefinition, AddChi
5960
}
6061
}
6162

63+
get iconClass(): string {
64+
if (this.isLoaded) {
65+
return this.image.className;
66+
}
67+
68+
return this._iconClass;
69+
}
70+
71+
set iconClass(value: string) {
72+
this._iconClass = value;
73+
74+
if (this.isLoaded) {
75+
this.image.className = value;
76+
}
77+
}
78+
6279
get iconSource(): string {
6380
if (this.isLoaded) {
6481
return this.image.src;
@@ -79,6 +96,7 @@ export class TabStripItem extends View implements TabStripItemDefinition, AddChi
7996
if (!this.image) {
8097
const image = new Image();
8198
image.src = this.iconSource;
99+
image.className = this.iconClass;
82100
this.image = image;
83101
this._addView(this.image);
84102
}
@@ -176,6 +194,7 @@ export class TabStripItem extends View implements TabStripItemDefinition, AddChi
176194
if (value instanceof Image) {
177195
this.image = <Image>value;
178196
this.iconSource = (<Image>value).src;
197+
this.iconClass = (<Image>value).className;
179198
this._addView(value);
180199
// selectedIndexProperty.coerce(this);
181200
}

0 commit comments

Comments
 (0)