You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+22-4Lines changed: 22 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,6 +40,10 @@ This will ask you few questions about your project and generate a new project in
40
40
- TypeScript definitions (uses `tsc` to generate declaration files)
41
41
- Android AAR files
42
42
43
+
If you created a project with `create-react-native-library`, `react-native-builder-bob` is already pre-configured to build your project. You don't need to configure it again.
44
+
45
+
The following configuration steps are for projects not created with `create-react-native-library`.
46
+
43
47
### Automatic configuration
44
48
45
49
To automatically configure your project to use `react-native-builder-bob`, open a Terminal and run:
@@ -204,13 +208,26 @@ Just as an example, this is a command we have in one of the packages: `babel --e
204
208
205
209
If your library depends on another react-native library containing native code, you should do the following:
206
210
207
-
- Add the native library to `peerDependencies`: This makes sure that there are no conflicts between the version you have specified and the version user has installed (in case they also want to use that library). By deferring the installation to the user, it also makes sure the package manager installs it in correct location and that autolinking can work properly.
208
-
- Add the native library to `devDependencies`: This makes sure that you can use it for tests, and there are no other errors such as type errors due to the missing module.
209
-
- Add the native library to `dependencies` under `example`: This is equivalent to the consumer of the library installing the dependency, and is needed so that this module is also available to the example app.
211
+
-**Add the native library to `peerDependencies`**
212
+
213
+
This means that the user will need to install the native library and add it to their `package.json`. It makes sure that:
214
+
215
+
- There are no version conflicts if another package also happens to use the same library, or if the user wants to use the library in their app. While there can be multiple versions of a JavaScript-only library, there can only be one version of a native library - so avoiding version conflicts is important.
216
+
- The package manager installs it in correct location so that autolinking can work properly.
217
+
218
+
Don't add the native library to `dependencies`, otherwise it may cause issues for the user even if it seems to work.
219
+
220
+
-**Add the native library to `devDependencies`**
221
+
222
+
This makes sure that you can use it for tests, and there are no other errors such as type errors due to the missing module.
223
+
224
+
-**Add the native library to `dependencies` in the `package.json` under `example`**
225
+
226
+
This is equivalent to the consumer of the library installing the dependency, and is needed so that this module is also available to the example app.
210
227
211
228
## Development workflow
212
229
213
-
To get started with the project, run `yarn` in the root directory to install the required dependencies.
230
+
This project uses a monorepo using `yarn`. To setup the project, run `yarn` in the root directory to install the required dependencies.
214
231
215
232
```sh
216
233
yarn
@@ -247,6 +264,7 @@ Thanks to the authors of these libraries for inspiration:
0 commit comments