Components

Gravity Native comes packed with a full suite of pre-built components you can drop into your app. From icons to charts to forms, modals and notifications – building your app is almost too easy.

Importing Components

Gravity's components are exported from a central component file, so you can import multiple components from one location in one statement.

import { AppContext, ViewContainer, Button } from '~/components/lib' 

Expo has an annoying habit of displaying require cycle warnings when doing this. It won't affect your app, but it's frustrating when your console is clogged with these warnings.

Gravity Native executes a postinstall script in /scripts/ignore.js that will switch off these warnings. Depending on which version of Expo you're using, you may need to do this manually.

Just search for 'require cycles' inside:

./node_modules/metro-config/node_modules/metro-runtime/src/polyfills/require.js

and remove the console warning line.

You can also choose to import each component from its original file if you prefer, but when importing lots of components, this is inefficient compared to using a single library file.

Last updated