zpao / qrcode.react

A <QRCode/> component for use with React.

Home Page:https://zpao.github.io/qrcode.react/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

v3

zpao opened this issue · comments

v2 v3 needs to happen. There are a number of things that I'd like to be a part of this, some of which have been attempted in the past, or are long standing issues.

TODO:

  • Rewrite in TypeScript. This will help avoid issues of types being out date. We can export types directly and not rely on community maintained types.
  • Replace qr.js dependency. As noted in #168 the original repo was taken over. While this isn't an active issue (that wasn't even the original author of qr.js, npm has not been taken over), it would still be good to find a more stable/modern dependency (potentially vendored to make this a zero dependency install). This may also enable some additional functionality that is impossible - for example: #157
  • Use React Hooks. The current class approach is outdated and while it allows us to support a wider range of React versions, it also makes it harder to support modern features that could further enable other functionality.
  • Support ES Modules. Obviously we can't drop CJS entirely but we can shift primary use to modern module practices. #49 started going there but had issues. We can probably get away with just doing this with Typescript builds directly now. Part of this may also end up being splitting SVG and Canvas renderers out BUT part of the argument for ES Modules is direct support for tree shaking anyway.

Open Questions:

  • Should we support the general QRCode component or just expose QRCodeSVG and QRCodeCanvas? There's not a whole lot of harm, though currently I'd do this as a default export (which isn't great).

Things I do not want to support in v2:

  • Direct support for download functionality. I'm hopeful that refs can enable this in user space.
  • Different QR Code design features (colors, rounded shapes, etc). While some parts of that may become easier as noted above, I think at least 2.0.0 should just support that same QR Code features.

an alternative to qr.js could be https://github.com/soldair/node-qrcode

Most of this is happening in https://github.com/zpao/qrcode.react/tree/typescript, should be ready soon(ish)