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: docs/pages/create.md
+22-1Lines changed: 22 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -31,7 +31,28 @@ After the project is created, you can find the development workflow in the gener
31
31
32
32
## Local library
33
33
34
-
While the default templates are for libraries that are published to npm, you can also create a local library that is not published, but used locally in your app.
34
+
While the default templates are for libraries that are published to npm, you can also create a local library that is not published but used locally in your app.
35
+
36
+
You'd typically use a local library when:
37
+
38
+
- You're building a native library for your app and don't want to publish it to npm.
39
+
- You want to be able to easily copy the library to other projects.
40
+
- You're in a monorepo and want to keep the library code in the same repository as the app.
41
+
- You're using Expo, but want to use vanilla React Native API for native modules and components.
42
+
43
+
The structure of the app with a local library may look like this:
44
+
45
+
```sh
46
+
MyApp
47
+
βββ node_modules
48
+
βββ modules <-- folder for your local libraries
49
+
β βββ awesome-library <-- your local library
50
+
βββ android
51
+
βββ ios
52
+
βββ src
53
+
βββ index.js
54
+
βββ package.json
55
+
```
35
56
36
57
If you run `create-react-native-library` in an existing project containing a `package.json`, it'll be automatically detected and you'll be asked if you want to create a local library. You can also pass the `--local` flag to the command to explicitly create a local library:
0 commit comments