mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-26 03:01:51 +08:00
Fixes TabView icons changes. (#4666)
* Fixes TabView icons/title changes. * Access TabLayput trough parent * TabView icon change example
This commit is contained in:

committed by
GitHub

parent
d8f0430fef
commit
50d399101e
@ -19,6 +19,7 @@ export function loadExamples() {
|
||||
examples.set("tabmore", "tab-view/tab-view-more");
|
||||
examples.set("tabViewCss", "tab-view/tab-view-css");
|
||||
examples.set("tab-view-icons", "tab-view/tab-view-icon");
|
||||
examples.set("tab-view-icon-change", "tab-view/tab-view-icon-change");
|
||||
examples.set("text-transform", "tab-view/text-transform");
|
||||
return examples;
|
||||
}
|
||||
|
17
apps/app/ui-tests-app/tab-view/tab-view-icon-change.ts
Normal file
17
apps/app/ui-tests-app/tab-view/tab-view-icon-change.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import { EventData } from "tns-core-modules/data/observable";
|
||||
import { Button } from "tns-core-modules/ui/button";
|
||||
import { TabView, SelectedIndexChangedEventData } from "tns-core-modules/ui/tab-view";
|
||||
|
||||
export function onSelectedIndexChanged(args: SelectedIndexChangedEventData) {
|
||||
const tabView = args.object as TabView;
|
||||
|
||||
const newItem = tabView.items[args.newIndex];
|
||||
if (newItem) {
|
||||
newItem.iconSource = "res://icon";
|
||||
}
|
||||
|
||||
const oldItem = tabView.items[args.oldIndex];
|
||||
if (oldItem) {
|
||||
oldItem.iconSource = "res://testlogo";
|
||||
}
|
||||
}
|
16
apps/app/ui-tests-app/tab-view/tab-view-icon-change.xml
Normal file
16
apps/app/ui-tests-app/tab-view/tab-view-icon-change.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="onNavigatingTo">
|
||||
<TabView id="tab-view" selectedIndexChanged="onSelectedIndexChanged" iosIconRenderingMode="alwaysOriginal">
|
||||
<TabView.items>
|
||||
<TabViewItem iconSource="res://icon">
|
||||
<TabViewItem.view>
|
||||
<Label text="first tab"/>
|
||||
</TabViewItem.view>
|
||||
</TabViewItem>
|
||||
<TabViewItem iconSource="res://testlogo">
|
||||
<TabViewItem.view>
|
||||
<Label text="second tab"/>
|
||||
</TabViewItem.view>
|
||||
</TabViewItem>
|
||||
</TabView.items>
|
||||
</TabView>
|
||||
</Page>
|
Reference in New Issue
Block a user