mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 03:31:45 +08:00
18 lines
577 B
TypeScript
18 lines
577 B
TypeScript
import { BottomNavigation, SelectedIndexChangedEventData } from "tns-core-modules/ui/bottom-navigation";
|
|
|
|
export function onSelectedIndexChanged(args: SelectedIndexChangedEventData) {
|
|
const bottomNav = <BottomNavigation>args.object;
|
|
|
|
const newItem = bottomNav.tabStrip.items[args.newIndex];
|
|
if (newItem) {
|
|
newItem.iconSource = "res://icon";
|
|
newItem.title = "selected";
|
|
}
|
|
|
|
const oldItem = bottomNav.tabStrip.items[args.oldIndex];
|
|
if (oldItem) {
|
|
oldItem.iconSource = "res://testlogo";
|
|
oldItem.title = "unselected";
|
|
}
|
|
}
|