React Native API references
There is no separate GlamAR.init contract for Capture IQ on React Native. You embed the same <glamar-captureiq> Web Component inside a WebView, drive it with the element’s methods and DOM events in injected JavaScript, and forward outcomes to React Native (for example with window.ReactNativeWebView.postMessage).
Contract source
- In this documentation site: Configuration, Methods, Events — authoritative for attributes,
config, presets, and runtime behavior. - In the demo repo:
docs/capture-iq/captureiq.md— mirrors the Capture IQ contract for offline reference next to the sample code.
WebView integration
| Concern | Typical approach |
|---|---|
| Load SDK | <script src="…/captureiq"> (full script URL) inside injected HTML, or equivalent injection from captureIqHtml.js in the demo. |
| Mount element | Create <glamar-captureiq> with api-key, preset, optional config (stringify JSON when using the attribute form). |
| Lifecycle | After ready / init(), call start(); tear down with destroy() when closing the WebView or navigating away. |
| Results | Listen for captureSuccess in JS; serialize what the bridge can carry (the demo uses output.format: "dataUrl" for <Image />). |
| Errors | Forward error, licenseError, cameraError, captureFail, etc., the same way as success payloads if you need native alerts. |
Bridge and postMessage
The demo’s injected script posts a message to React Native when capture succeeds. Your production app should:
- Validate and parse JSON in
onMessage. - Avoid sending large binary payloads if not needed; data URLs or uploaded URLs are easier to handle than raw blobs across the bridge.