We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d8e90a8 commit 9f1a301Copy full SHA for 9f1a301
3 files changed
.changeset/bumpy-things-poke.md
@@ -0,0 +1,5 @@
1
+---
2
+"react-native-node-api": patch
3
4
+
5
+Fix requireNodeAddon return type
packages/host/src/react-native/NativeNodeApiHost.ts
packages/host/src/react-native/index.ts
@@ -1,3 +1,14 @@
-import native from "./NativeNodeApiHost";
+import { type TurboModule, TurboModuleRegistry } from "react-native";
-export const requireNodeAddon = native.requireNodeAddon.bind(native);
+export interface Spec extends TurboModule {
+ requireNodeAddon<T = unknown>(libraryName: string): T;
+}
6
7
+const native = TurboModuleRegistry.getEnforcing<Spec>("NodeApiHost");
8
9
+/**
10
+ * Loads a native Node-API addon by filename.
11
+ */
12
+export function requireNodeAddon<T = unknown>(libraryName: string): T {
13
+ return native.requireNodeAddon<T>(libraryName);
14
0 commit comments