Skip to content

Commit 3d58058

Browse files
Update tabView page
1 parent cc16782 commit 3d58058

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

apps/app/ui-tests-app/tab-view/tab-view-icon.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,18 @@ import { TabView } from "tns-core-modules/ui/tab-view";
44

55
let iconModes = ["automatic", "alwaysOriginal", "alwaysTemplate", undefined];
66

7-
export function onChangeRenderingMode(args: EventData){
8-
let button = (<Button>args.object);
9-
let tabView = button.page.getViewById<TabView>("tab-view");
10-
7+
export const onNavigate = updateButtons;
8+
9+
export function onChangeRenderingMode(args: EventData) {
10+
let tabView = (<Button>args.object).page.getViewById<TabView>("tab-view");
1111
tabView.iosIconRenderingMode = <"automatic" | "alwaysOriginal" | "alwaysTemplate">iconModes[(iconModes.indexOf(tabView.iosIconRenderingMode) + 1) % iconModes.length];
12+
updateButtons(args);
13+
}
1214

13-
for(let i = 0, length = tabView.items.length; i < length; i++){
14-
(<Button>tabView.items[i].view).text = "" + tabView.iosIconRenderingMode;
15+
function updateButtons(args) {
16+
let button = (<Button>args.object);
17+
let tabView = button.page.getViewById<TabView>("tab-view");
18+
for (let i = 0, length = tabView.items.length; i < length; i++) {
19+
(<Button>tabView.items[i].view).text = "" + tabView.iosIconRenderingMode;
1520
}
1621
}

apps/app/ui-tests-app/tab-view/tab-view-icon.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Page xmlns="http://schemas.nativescript.org/tns.xsd">
1+
<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="onNavigate">
22
<TabView id="tab-view" tabTextColor="green" selectedTabTextColor="red" tabBackgroundColor="yellow">
33
<TabView.items>
44
<TabViewItem iconSource="res://icon">

0 commit comments

Comments
 (0)