Quick Setup
To have NativeBase components running onto your native apps, all you need to do is, create a fresh React Native project and install the NativeBase using npm.
System Requirements
- Globally installed node >= 6.0
- Globally installed npm >= 4.0
- Globally installed React Native CLI which allow you to easily create and initialize projects.
- Click here to know about React Native version compatibility with NativeBase.
Create React Native project
react-native init AwesomeNativeBase
cd AwesomeNativeBase
Install NativeBase
npm install native-base --save
Install Peer Dependencies
The peer dependencies included from any npm packages does not automatically get installed. Your application will not depend on it explicitly.
react-native link
You've successfully setup NativeBase with your React Native app. Your React Native app is ready to run on iOS and Android devices.
1. Setup with CRNA
Create React Native project using the CRNA CLI.
CRNA helps you make React Native apps with no build configuration. Create React App works on macOS, Windows, and Linux.
Refer this link for additional information CRNA
Install NativeBase
npm install native-base --save
Install @expo/vector-icons
npm install @expo/vector-icons --save
NativeBase uses some custom fonts that can be loaded using loadAsync function. Check out this expo link.
Syntax
async componentWillMount() {
await Expo.Font.loadAsync({
'Roboto': require('native-base/Fonts/Roboto.ttf'),
'Roboto_medium': require('native-base/Fonts/Roboto_medium.ttf'),
});
}
Check out the NativeBase KitchenSink with CRNA for an example of NativeBase components implementation.
Here's the source code for NativeBase KitchenSink.