mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
22 lines
900 B
TypeScript
22 lines
900 B
TypeScript
import { EventData } from '@nativescript/core/data/observable';
|
|
import { Button } from '@nativescript/core/ui/button';
|
|
import { TabView } from '@nativescript/core/ui/tab-view';
|
|
|
|
let iconModes = ['automatic', 'alwaysOriginal', 'alwaysTemplate', undefined];
|
|
|
|
export const onNavigate = updateButtons;
|
|
|
|
export function onChangeRenderingMode(args: EventData) {
|
|
let tabView = (<Button>args.object).page.getViewById<TabView>('tab-view');
|
|
tabView.iosIconRenderingMode = <'automatic' | 'alwaysOriginal' | 'alwaysTemplate'>iconModes[(iconModes.indexOf(tabView.iosIconRenderingMode) + 1) % iconModes.length];
|
|
updateButtons(args);
|
|
}
|
|
|
|
function updateButtons(args) {
|
|
let button = <Button>args.object;
|
|
let tabView = button.page.getViewById<TabView>('tab-view');
|
|
for (let i = 0, length = tabView.items.length; i < length; i++) {
|
|
(<Button>tabView.items[i].view).text = '' + tabView.iosIconRenderingMode;
|
|
}
|
|
}
|