-
Notifications
You must be signed in to change notification settings - Fork 53
Other Installation Options
You may prefer to clone this repo and use it in your project instead of using what is published on npm. The steps below describe how to do that.
-
Create a new React Native project.
# Update react-native-cli npm install -g react-native-cli # Create a new project react-native init MyApp # Start the RN server cd MyApp react-native start
-
Install the react-native-couchbase-mobile module relatively to the root of this repo.
npm install ./../
-
Link it with your MyApp project.
rnpm link react-native-couchbase-lite
-
Follow those steps in the README to add the remaining dependencies for iOS and Android.
$ react-init RNTestProj
$ cd RNTestProj
$ npm install react-native-couchbase-lite --save
- Drag the ReactCBLite Xcode project in your React Native Xcode project:
- Add ReactCBLite.a (from Workspace location) to the required Libraries and Frameworks.
-
From the
Link Binary With Libraries
section in theBuild Phases
of the top-level project, add the following frameworks in your Xcode project (Couchbase Lite dependencies):- libsqlite3.0.tbd
- libz.tbd
- Security.framework
- CFNetwork.framework
- SystemConfiguration.framework
-
Download the Couchbase Lite iOS SDK from here and drag CouchbaseLite.framework, CouchbaseLiteListener.framework in the Xcode project:
- Install both npm modules:
$ npm install react-native
$ npm install react-native-couchbase-lite
- In the
Podfile
, add dependencies:
pod 'React', :path => './node_modules/react-native'
pod 'ReactNativeCouchbaseLite', :path => './node_modules/react-native-couchbase-lite'
- Install the Cocoapods dependencies:
$ pod install
- So far so good! Next, you must install CBLRegisterJSViewCompiler.h and libCBLJSViewCompiler.a. You can download both components from here. Drag CBLRegisterJSViewCompiler.h into the couchbase-lite-ios Pod:
- Add the libCBLJSViewCompiler.a static library:
-
Add the
react-native-couchbase-lite
project to your existing React Native project inandroid/settings.gradle
... include ':react-native-couchbase-lite' project(':react-native-couchbase-lite').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-couchbase-lite/android')
-
Add the Couchbase Maven repository to
android/build.gradle
allprojects { repositories { mavenLocal() jcenter() // add couchbase url maven { url "http://files.couchbase.com/maven2/" } } }
-
Add
android/app/build.gradle
apply plugin: 'com.android.application' android { ... packagingOptions { exclude 'META-INF/ASL2.0' exclude 'META-INF/LICENSE' exclude 'META-INF/NOTICE' } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:23.0.0' compile 'com.facebook.react:react-native:0.12.+' // Add this line: compile project(':react-native-couchbase-lite') }
-
Register the module in
getPackages
ofMainApplication.java
@Override protected List<ReactPackage> getPackages() { return Arrays.<ReactPackage>asList( new MainReactPackage(), new ReactCBLiteManager() <----- Register the module ); }
MIT