-
-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathnavigation-vm.js
More file actions
122 lines (112 loc) · 3.08 KB
/
navigation-vm.js
File metadata and controls
122 lines (112 loc) · 3.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
import { Frame } from "tns-core-modules/ui/frame";
import { BaseModel } from "./pages/base";
import * as application from "tns-core-modules/application";
import { ObservableArray } from "tns-core-modules/data/observable-array";
export class NavigationViewModel extends BaseModel {
constructor(page) {
super(page);
this.selectedPage = "";
this.pages = new ObservableArray({
text: "Home",
value: "root",
icon: "home"
}, {
value: "Basics",
icon: "font"
}, {
value: "Buttons",
icon: "square"
}, {
text: "Active Buttons",
value: "buttons-active",
icon: "square-o"
}, {
value: "Colors",
icon: "eyedropper"
}, {
value: "Dialogs",
icon: "newspaper-o"
}, {
value: "Forms",
icon: "i-cursor"
}, {
value: "Pickers",
icon: "list-alt"
}, {
text: "DataForm",
value: "dataform",
icon: "database"
}, {
text: "ListView",
value: "listview",
icon: "list"
}, {
text: "RadListView",
value: "radlistview",
icon: "th-list"
}, {
text: "Login",
value: "login-landing",
icon: "user"
}, {
value: "Modal",
icon: "window-maximize"
}, {
value: "Progress",
icon: "spinner"
}, {
value: "Search",
icon: "search"
}, {
text: "SegmentedBar",
value: "segmentedbar",
icon: "columns"
}, {
value: "Sliders",
icon: "sliders"
}, {
value: "Switches",
icon: "toggle-on"
}, {
text: "TabView",
value: "tabview",
icon: "road"
}, {
text: "Tabs",
value: "tabs",
icon: "ellipsis-h"
}, {
text: "BottomNavigation",
value: "bottomnav",
icon: "ellipsis-v"
}, {
text: "Custom ActionBar",
value: "custom-actionbar",
icon: "minus"
});
}
onNavigationItemTap({ object: list, index }) {
const page = (list.items[index] || list.items.getItem(index)).value;
if (page === "Modal") {
return this.openModal();
}
Frame.topmost().navigate({
moduleName: `pages/${page.toLowerCase()}`,
transition: {
name: "slide"
}
});
this.selectedPage = page;
application.getRootView().closeDrawer();
}
viewPage(args) {
const button = args.object;
const pageName = button.value;
const navigationEntry = {
moduleName: `pages/${pageName}`,
clearHistory: true
};
Frame.topmost().navigate(navigationEntry);
this.bindingContext.selectedPage = pageName;
}
}