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/HOW-IT-WORKS.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,3 @@
1
-
2
1
# How it works
3
2
4
3
This document will outline what happens throughout the various parts of the system, when the app calls the `add` method on the library introduced in the ["usage" document](./USAGE.md).
@@ -51,6 +50,7 @@ If we don't have one for the current `jsi::Runtime` already, one is created, by
51
50
## The library's C++ code initialize the `exports` object
52
51
53
52
An `exports` object is created for the Node-API module and both the `napi_env` and `exports` object is passed to the Node-API module's initialization function and the third party code is able to call the Node-API free functions:
53
+
54
54
- The engine-specific functions (see [js_native_api.h](https://github.com/nodejs/node/blob/main/src/js_native_api.h)) are implemented by the `jsi::Runtime` (currently only Hermes supports this).
55
55
- The runtime-specific functions (see [node_api.h](https://github.com/nodejs/node/blob/main/src/node_api.h)) are implemented by `react-native-node-api-modules`.
Copy file name to clipboardExpand all lines: docs/USAGE.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,7 @@
3
3
The purpose of this document is to explain how Node-API modules are supported all the way from an app loading a library package to the library's native code returning a JavaScript value to from a function call.
4
4
5
5
For the purpose of the explanation, we'll introduce a two fictitious packages:
6
+
6
7
-`calculator-lib`: A package publishing a Node-API module.
7
8
-`my-app`: An app depending on `calculator-lib`.
8
9
@@ -16,12 +17,12 @@ The app developer has to install both `calculator-lib` as well as `react-native-
16
17
The reason for the latter is a current limitation of the React Native Community CLI which doesn't consider transitive dependencies when enumerating packages for auto-linking.
17
18
18
19
> [!WARNING]
19
-
> It's important to match the exact version of the `react-native-node-api-modules` declared as peer dependency by `calculator-lib`.
20
+
> It's important to match the exact version of the `react-native-node-api-modules` declared as peer dependency by `calculator-lib`.
20
21
21
22
For the app to resolve the Node-API dynamic library files, the app developer must update their Metro config to use a `resolveRequest` function exported from `react-native-node-api-modules`:
0 commit comments