ReaderConnection
ReaderConnection is the pay sheet's one line about the card reader, and reconnects the remembered reader once.
Import
import { ReaderConnection } from '@tallyui/components';Usage
<ReaderConnection
driver={driver}
method={method}
rememberedReaderId={settings.readerId}
handoff={handoff}
onTransport={setTransport}
onOpenSettings={() => router.push('/settings/card-readers')}
/>The line reads "{name} · Connected · {battery}%" for a connected reader, "Updating reader software {progress}" during an update, "Connecting…" while connecting, "Could not reconnect to the reader" after a failed reconnect, and "No reader connected" otherwise. A Tap to Pay reader is named "This device". When no reader is connected and onOpenSettings is given, a "Connect in Settings → Card readers" link opens the host's settings.
On mount it reconnects rememberedReaderId once: if the driver already holds that reader it only calls onTransport; otherwise it asks discoverReaders on each of the method's transports in order, connects the first match with handoff, then calls onTransport with its transport.
It follows WCPOS v2's reader-connection.tsx. Storing the remembered reader, fetching the handoff and routing to settings are the host's.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
driver | PaymentDriver | required | The method's payment driver |
method | PaymentMethodDescriptor | required | The method; its hardware transports are tried in order |
rememberedReaderId | string | null | — | The reader to reconnect once on mount |
handoff | Record<string, unknown> | null | — | Provider data passed to connect |
onTransport | (transport: PaymentTransport) => void | — | Called with the reader's transport after a reconnect, or when the held reader is the remembered one |
onOpenSettings | () => void | — | Opens the host's card-reader settings; no link without it |
disabled | boolean | false | Skips the reconnect and disables the link |
testID | string | 'reader-connection' | Test identifier |