Dynamic Menu

📘

Sidebar menu items can be loaded dynamically from your website using the GoNative Javascript Bridge. The new menu items can be loaded on specific pages or subsequent to events such as a user login flow. A default menu can be defined in the app configuration that is then overwritten dynamically as required. Or alternatively, the configuration can be left blank and all menus set by the website.

️GoNative JavaScript Bridge

To set the example sidebar navigation menu options run the command below.
The enabled parameter is required to activate the sidebar if it is hidden.
The persist parameter is used to keep the changes after your app is closed and reloaded.

var items = [{
          label: "Google",
          url: "https://google.com",
          icon: "fas fa-cog" // optional Font Awesome icon
        }, {
          label: "Sample Grouping",
          isGrouping: true, 
          subLinks: [{
            label: "Apple",
            url: "https://apple.com",
            icon: "fas fa-home" // optional
          }, {
            label: "Google",
            url: "https://google.com",
            icon: "fas fa-home" //optional
          }]
        }, {
          label: "Sample Javascript",
          url: "javascript:alert('test')"
      }];

gonative.sidebar.setItems({"items":items,"enabled":true, "persist":true});