mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-03-26 07:04:05 +08:00
Merge pull request #4797 from Kureev/chore/add-docs-linking-automation-section
Add a section about linking process automation using rnpm
This commit is contained in:
@@ -24,7 +24,41 @@ error as soon as you try to use the library._
|
||||
|
||||
## Here the few steps to link your libraries that contain native code
|
||||
|
||||
### Step 1
|
||||
### Automatic linking
|
||||
|
||||
"[rnpm](http://github.com/rnpm/rnpm)" is a community project that allows linking of native dependencies automatically:
|
||||
|
||||
#### Step 1
|
||||
|
||||
Install `rnpm`:
|
||||
```bash
|
||||
$ npm install rnpm -g
|
||||
```
|
||||
|
||||
**Note:** _`rnpm` requires `node` version 4.1 or higher_
|
||||
|
||||
#### Step 2
|
||||
|
||||
Install a library with native dependencies:
|
||||
```bash
|
||||
$ npm install library-with-native-dependencies --save
|
||||
```
|
||||
|
||||
**Note:** _`--save` or `--save-dev` flag is very important for this step. `rnpm` will link
|
||||
your libs based on `dependencies` and `devDependencies` in your `package.json` file._
|
||||
|
||||
#### Step 3
|
||||
|
||||
Link your native dependencies:
|
||||
```bash
|
||||
$ rnpm link
|
||||
```
|
||||
|
||||
Done! All libraries with a native dependencies should be successfully linked to your iOS/Android project.
|
||||
|
||||
### Manual linking
|
||||
|
||||
#### Step 1
|
||||
|
||||
If the library has native code, there must be a `.xcodeproj` file inside it's
|
||||
folder.
|
||||
@@ -33,7 +67,7 @@ on Xcode);
|
||||
|
||||

|
||||
|
||||
### Step 2
|
||||
#### Step 2
|
||||
|
||||
Click on your main project file (the one that represents the `.xcodeproj`)
|
||||
select `Build Phases` and drag the static library from the `Products` folder
|
||||
@@ -41,7 +75,7 @@ inside the Library you are importing to `Link Binary With Libraries`
|
||||
|
||||

|
||||
|
||||
### Step 3
|
||||
#### Step 3
|
||||
|
||||
Not every library will need this step, what you need to consider is:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user