All functionality in BlueBase is added via plugins. Let us add some ready-made plugins to our project to take a head start on building our app.
Start by adding following devDependencies:
Some of the plugins (react-navigation) require some more dependencies to be installed:
Now in the root folder create the following file plugins.ts
:
The file above exports an array of plugins, imported from their respective modules.
Create another file similar to the one above and name it plugins.native.ts
. This way react-native compiler will load this version rather than plugins.ts
on native platforms.
So by doing this, we can add web-specific plugins in plugins.ts
and native specific code in plugins.native.ts
.
In this case, the difference in the above 2 files is that plugins.ts
uses:
@bluebase/plugin-react-router
@bluebase/plugin-material-ui
While plugins.native.ts
uses the following instead:
@bluebase/plugin-react-navigation
@bluebase/plugin-react-native-paper
Now edit the App.tsx
file and add the following content.
Here, we import the plugins array and pass them to the BlueBaseApp
component as a prop.
Lastly, modify the contents of babel.config.js
file to:
Now run the app again:
You should see the following screen on launch:
So as you can see, by just installing a few plugins, we were able to add a lot of functionality in a very short span of time, by writing very few lines of code.
I'll try to briefly describe what purpose each plugin serves.
@bluebase/plugin-launcher
Adds Android-like "launcher" home screen, that shows app icons.
@bluebase/plugin-settings-app
Adds the Settings section to the app. If you remove this plugin, the settings icon on the home screen will disappear.
@bluebase/plugin-json-schema-components
Provides components that help us build layouts by writing JSON. This is used by the settings plugin.
@bluebase/plugin-material-ui
@bluebase/plugin-react-router
@bluebase/plugin-react-native-paper
@bluebase/plugin-react-navigation
@bluebase/plugin-responsive-grid
Provides Grid components (Column, Row, etc). Used by Launcher plugin.
@bluebase/plugin-vector-icons
Provides Material UI components on the web. Uses the library.
Provides Navigation capability on the web. Uses the library.
Provides Material UI components on native. Uses the library.
Provides Navigation capability on native. Uses the library.
Provides SVG vector icons used on various screens, as shown above. Uses the library.