WKWebView, Android WebView, iframe, and standalone browser β with automatic environment detection and progressive enhancement.
Packages
The SDK is published as two npm packages β the core library you can use anywhere, and a thin React wrapper if youβre using React 19+:Installation
To install the SDK, run one of the commands below:Quick start: Core library
Get a singleton bridge instance, check the environment, request a native capability, and listen for host events β all from plain TypeScript:Quick start: React
Wrap your app in<BridgeProvider> and use the hooks β useBridge for environment and capability state, useNativeCamera for capture requests with web fallback:
Environment behaviour
In standalone mode, the bridge is fully functional but reports no capabilities. This enables progressive enhancement β your app works in any environment, and native features activate automatically when a host is present.
Standard capabilities
Common pitfalls
Watch out for these common integration mistakes:- Donβt use the bridge in SSR: it requires
windowand browser APIs. In Next.js, ensure bridge code only runs on the client. See the Next.js usage guide. - Always check capabilities before requesting: donβt assume a capability is available. Use
hasCapability()or theuseCapability()hook first. - Handle timeouts: the default request timeout is 30 seconds. Camera requests via
useNativeCamerause 120 seconds. - Call
discoverCapabilities()early:<BridgeProvider>does this automatically, but if using the core library directly, call it early in your app lifecycle. - The bridge is a singleton:
NativeBridge.getInstance()always returns the same instance. Options are only used on the first call.
Guides
- Configuration β Bridge options, timeouts, and React provider configuration
- React hooks β
useBridge,useCapability,useNativeCamera,useBridgeEvent - Error handling β Typed error codes, recoverability, and handling patterns
- Security β Transport security, iframe origin validation, PII handling
- Next.js usage β App Router and Pages Router integration
- API reference β Complete reference for all public exports