NativeJS - Sidebar navigation
You may turn on native sidebar navigation in your config, leave the menu blank, and then use the following javascript NativeJS Bridge to set the values.
1
var items = [{
2
label: "google",
3
url: "https://google.com",
4
icon: "fa-cog" // optional font awesome 4.7 icon
5
}, {
6
label: "sample grouping",
7
isGrouping: true,
8
subLinks: [{
9
label: "apple",
10
url: "https://apple.com",
11
icon: "fa-home" // optional
12
}, {
13
label: "google",
14
url: "https://google.com",
15
icon: "fa-home" //optional
16
}]
17
}, {
18
label: "sample javascript",
19
url: "javascript:alert('test')"
20
}];
21
var json = JSON.stringify(items);
22
23
window.location.href = "gonative://sidebar/setItems?items=" + encodeURIComponent(json);
Copied!
Note that the window.location.href will be intercepted by your app, and nothing will actually load. Just the sidebar will be set.
Last modified 1yr ago
Copy link