Skip to content

Commit 8782a2b

Browse files
committed
docs: add a FAQ on what to do for react-native libraries
closes #95
1 parent 99d23f6 commit 8782a2b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,16 @@ Example:
195195
["aar", { "reverseJetify": true }]
196196
```
197197

198+
## FAQ
199+
200+
### How do I add a react-native library containing native code as a dependency in my library?
201+
202+
If your library depends on another react-native library containing native code, you should do the following:
203+
204+
- 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.
205+
- 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.
206+
- 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.
207+
198208
## Development workflow
199209

200210
To get started with the project, run `yarn` in the root directory to install the required dependencies.

0 commit comments

Comments
 (0)