Skip to content

feat(formplayer): add QrcodeQuestionRenderer for in-form QR code scanning#326

Merged
najuna-brian merged 2 commits intoOpenDataEnsemble:devfrom
najuna-brian:feature/formplayer-qrcode-renderer
Feb 16, 2026
Merged

feat(formplayer): add QrcodeQuestionRenderer for in-form QR code scanning#326
najuna-brian merged 2 commits intoOpenDataEnsemble:devfrom
najuna-brian:feature/formplayer-qrcode-renderer

Conversation

@najuna-brian
Copy link
Contributor

@najuna-brian najuna-brian commented Feb 16, 2026

Description

Adds the missing QrcodeQuestionRenderer so that schema fields with "format": "qrcode" render a native QR scanner control inside forms.

Closes #325

What changed

File Change
formulus-formplayer/src/renderers/QrcodeQuestionRenderer.tsx New renderer — scan button, scanned value display, rescan/delete, manual text entry fallback
formulus-formplayer/src/App.tsx Import + register in customRenderers (priority 10, formatIs('qrcode'))

How it works

  • Calls FormulusClient.requestQrcode(fieldId) → stores result.data.value as a plain string
  • Shows a tap-to-scan button when empty, a green chip with the value when scanned
  • Manual entry toggle for when the scanner is unavailable
  • Follows the same pattern as PhotoQuestionRenderer and SignatureQuestionRenderer
  • Wrapped in QuestionShell for consistent title/description/error display

Schema usage

{
  "qr_field": {
    "type": "string",
    "format": "qrcode",
    "title": "Scan QR code"
  }
}

Testing

  • Dev mock (webview-mock.ts) already simulates requestQrcode — works out of the box in dev mode
  • Verified: zero ESLint errors, Prettier formatted

@najuna-brian najuna-brian merged commit 77db727 into OpenDataEnsemble:dev Feb 16, 2026
10 checks passed
@najuna-brian najuna-brian deleted the feature/formplayer-qrcode-renderer branch February 16, 2026 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FormPlayer] Missing QrcodeQuestionRenderer

2 participants