Skip to content
Gravity Logo / Docs Gravity home
Browse documentation
Documentation/Gravity Native

Views

Views are the main screens in your application and are comprised of various components.

Gravity comes with pre-built views for you to use in your app, including:

  • Auth views (sign up, sign in, reset password)
  • Account views (profile, password, users)
  • Dashboard statistics screen

Info

Views are located in the /views directory

Creating a New View

Add a screen under views/. The component in views/dashboard/stats.js is a working example.

Your components within a view should always be wrapped inside a <ViewContainer> which will provide common components such as header, navigation and banner notifications.

Routing the View

Once you’ve built your view, you need to import it into /router.js and add it to a navigation stack.

Private Views

The navigator records screen metadata in initialParams, including private and permission. In AccountTabs, the Users tab is registered conditionally based on the signed-in user’s admin permission. Use the permission map when deciding which screens to expose and enforce access to their data on the server.