mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
18 lines
534 B
TypeScript
18 lines
534 B
TypeScript
import { BottomNavigation, SelectedIndexChangedEventData } from '@nativescript/core/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';
|
|
}
|
|
}
|