Installation

Platforms supported: React Native for Android and iOS (exclude expo projects)

The following steps will help you install Vasern into your React Native project.

Install Vasern

Make sure you have created React Native app. Navigate to React Native directory, and be ready to run commands on Terminal (MacOS) or Command Promp (Window).

1. Install using NPM:

$ npm install --save vasern

Automatic linking - for iOS and Android

$ react-native link vasern

Manual linking - for iOS

  • From your React Native directory, browse to node_modules/vasern/ios, then drag Vasern.xcodeproj to Libraries directory on your project in XCode.

  • In the XCode project, navigate to Build Phase > Link Binary with Libraries, click on + icon, find and add libVasern.a.

Manual linking - for Android

  1. Open file android/app/build.gradle from your android main app directory, add vasern dependency:
dependencies {
+   compile project(':vasern')

    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
    implementation "com.facebook.react:react-native:+"  // From node_modules
}
  1. Open file android/setting.gradle
include ':app'

+ include ':vasern'
+ project(':vasern').projectDir = new File(rootProject.projectDir, '../node_modules/vasern/android')
  1. Open android/app/src/main/java/{ bundle id }/MainApplication.java, add VasernManager package.
// Add this line after "import android.app.Application;"
+ import com.vasern.VasernManager;

// Add "new VasernManager()" in "getPackages()" method
@Override
protected List<ReactPackage> getPackages() {
    return Arrays.<ReactPackage>asList(
        new MainReactPackage(),
+       new VasernManager()
    );
}

3. Close Metro Bundle, rebuild and restart project.

What’s next? You have now installed Vasern into your React Native project. Learn more about data modeling or start Writing Schema.