Skip to main content

PairingFlow

Provides a nearby-device picker and pairing-code prompt. Render it below the Bluetooth runtime created by BTProvider.

<PairingFlow
storage={pairedDeviceStorage}
getDeviceImage={(device) => deviceImages[device.deviceData.model ?? ""]}
onPaired={(device) => analytics.track("device_paired", { id: device.id })}
onPairingCode={(code, device) => submitPairingCode(code, device)}
/>

Props​

  • storage: PairedDeviceStorage — required app-owned persistence adapter.
  • storageKey?: string — key used by usePairedDevices.
  • getDeviceImage?: (device: RuntimeDevice) => string | undefined.
  • onPaired?: (device: RuntimeDevice) => void.
  • onPairingCode?: (code: string, device: RuntimeDevice) => Promise<void> | void.
  • onError?: (error: Error, device?: RuntimeDevice) => void.
  • renderHeader?: (state: PairingFlowRenderState) => ReactNode.
  • renderEmpty?: (state: PairingFlowRenderState) => ReactNode.
  • renderDevice?: (device, actions) => ReactNode — replaces the default device row.
  • labels?: Record<string, string> — overrides the built-in English copy.
  • testID?: string.
  • theme? and slots? — shared OvokUiProps.

The flow listens for pairing and bonded runtime events and remembers paired IDs through the supplied storage. It does not create a BLE manager, upload results, or select a device family. Visible copy is currently English; wrap the flow or provide a host-owned localized replacement when needed. The current flow remembers the device after pair() resolves even if a later pairing/code event reports failure; apps that require confirmed bonding should validate the connection event and own the persist step instead of treating the stored ID as proof of a successful pairing.