mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-18 13:51:27 +08:00

* Fixes TabView icons/title changes. * Access TabLayput trough parent * TabView icon change example
18 lines
573 B
TypeScript
18 lines
573 B
TypeScript
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";
|
|
}
|
|
}
|