GuidesComponentsBluetooth management

BluetoothDevicePicker

Render a chooser for multiple devices discovered by BTProvider auto-connect.

  • Stable unknown
  • Release candidate since 1.16.1-rc.3
  • Development since 1.16.1-dev.2111+9796905

BluetoothDevicePicker is a theme-aware modal for presenting multiple BTDeviceSelection candidates. It is a view only: your callback decides how a choice affects the Bluetooth session.

Import it from @ovok/native/bt-management.

Connect it to auto-connect

When BTProvider has autoConnect enabled and more than one candidate is found during the settle window, it calls onDeviceSelectionRequired. Keep the supplied candidates and select callback in screen state, then pass them to the picker.

<BluetoothDevicePicker
  devices={selection.devices}
  visible={selection !== undefined}
  onSelect={(device) => {
    void selection.select(device);
    setSelection(undefined);
  }}
  onDismiss={() => setSelection(undefined)}
/>

Call the selection object's select(device) function. The picker calls your onSelect; it does not connect by itself.

Props

Every prop, with its type and description, is listed in the @ovok/native/bt-management API reference.

Last updated on

On this page