Files
NativeScript/apps/ui/app/bottom-navigation/icon-change-page.ts
Nathan Walker 1e6fccf272 chore: cleanup
2020-07-23 14:03:37 -07:00

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';
}
}