Pair with another device
Enter the 6-digit code shown on the other device.
{Array.from({ length: 6 }, (_, i) => (
{
const current = codeInput();
const digit = (e.currentTarget as HTMLInputElement).value.replace(/\D/g, "").slice(-1);
const newValue = current.slice(0, i) + digit + current.slice(i + 1);
setCodeInput(newValue.slice(0, 6));
setCodeError(null);
if (digit && i < 5) {
const inputs = document.querySelectorAll(".peach-pairing-code-box");
(inputs[i + 1] as HTMLInputElement)?.focus();
}
}}
onKeyDown={(e) => {
if (e.key === "Backspace" && !codeInput()[i] && i > 0) {
const inputs = document.querySelectorAll(".peach-pairing-code-box");
(inputs[i - 1] as HTMLInputElement)?.focus();
}
}}
/>
))}
{codeError()}