Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/bumpy-things-poke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"react-native-node-api": patch
---

Fix requireNodeAddon return type
8 changes: 0 additions & 8 deletions packages/host/src/react-native/NativeNodeApiHost.ts

This file was deleted.

15 changes: 13 additions & 2 deletions packages/host/src/react-native/index.ts
Original file line number Diff line number Diff line change
@@ -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;
}

const native = TurboModuleRegistry.getEnforcing<Spec>("NodeApiHost");

/**
* Loads a native Node-API addon by filename.
*/
export function requireNodeAddon<T = unknown>(libraryName: string): T {
return native.requireNodeAddon<T>(libraryName);
}