@gbgplc-internal/ggo-native-bridge package and the React bindings in @gbgplc-internal/ggo-native-bridge-react. Use it alongside the TypeScript Bridge SDK overview when you need exact type signatures, options, or return shapes.
Core package: @gbgplc-internal/ggo-native-bridge
The package is published as an ES module with no dependencies and runs in the browser only. The example import below names the public exports referenced throughout the rest of this section:
NativeBridge
The main bridge class. Singleton β use NativeBridge.getInstance() to obtain the instance.
NativeBridge.getInstance(options?)
Returns the singleton bridge instance. Creates it on the first call; subsequent calls return the existing instance (ignoring options).
NativeBridge.resetInstance()
Destroys the current singleton and resets to null. For testing only.
Properties
bridge.discoverCapabilities(timeoutMs?)
{} in standalone mode.
bridge.hasCapability(id) / bridge.getCapability(id) / bridge.getCapabilities()
discoverCapabilities() result.
bridge.request(action, data, options?)
BridgeError with appropriate code on timeout, error, unsupported, or cancelled status.
bridge.emit(action, data)
bridge.on(action, callback)
bridge.getMessageLog() / bridge.onMessageLog(callback)
onMessageLog callback at a time.
bridge.destroy()
Cleans up all resources. The instance is unusable after calling this.
detectEnvironment
window undefined β standalone, webkit.messageHandlers.gbgBridge β ios, GBGBridge.postMessage β android, window !== window.parent β iframe, otherwise standalone.
BridgeError
CAPABILITY_IDS
Types
React package: @gbgplc-internal/ggo-native-bridge-react
Peer dependencies: react@19.x, @gbgplc-internal/ggo-native-bridge@>=0.1.0
BridgeProvider
useBridge()
Returns BridgeContextValue:
useCapability(capabilityId)
Returns { supported: boolean; ready: boolean; version?: string }.
useNativeCamera(type: 'document' | 'selfie')
Returns { isNativeAvailable: boolean; requestCapture: (data?) => Promise<ResponsePayload> }.
Uses 120-second timeout and fallbackAllowed: true. Works outside <BridgeProvider> (returns isNativeAvailable: false).
useBridgeEvent(action, callback)
Subscribes to host events. Manages lifecycle automatically. Uses useRef internally so the callback doesnβt need memoization.
See React hooks guide for detailed usage examples.