@openlv/react-native
v0.0.1-beta.4
Published
A lightweight React Native shim around `@openlv/session`.
Readme
@openlv/react-native
A lightweight React Native shim around @openlv/session.
What it does
- Re-exports the
@openlv/sessionpublic API (so it can be close to a drop-in replacement). - Provides a single all-inclusive React provider that installs required polyfills (WebRTC + WebCrypto + randomness).
Install
This package expects you to install the native dependency in your React Native app:
react-native-webrtcreact-native-webviewreact-native-webview-cryptoreact-native-get-random-values
Usage
Include the runtime component somewhere in your app:
import { OpenLVGlobals } from "@openlv/react-native";
export function App() {
return (
<>
<OpenLVGlobals />
{/* the parts of your app that use OpenLV */}
</>
);
}Then use it like @openlv/session (no extra polyfill calls):
import { connectSession } from "@openlv/react-native";
const session = await connectSession("openlv://...", async (msg) => {
// ...handle requests...
return "ok";
});
await session.connect();