Page MenuHomePhabricator

[native] Add dependency to generate QR codes on native
ClosedPublic

Authored by rohan on Aug 16 2023, 10:24 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, May 1, 8:39 AM
Unknown Object (File)
Wed, Apr 24, 2:39 PM
Unknown Object (File)
Wed, Apr 24, 2:39 PM
Unknown Object (File)
Wed, Apr 24, 2:39 PM
Unknown Object (File)
Wed, Apr 24, 2:30 PM
Unknown Object (File)
Wed, Apr 24, 1:55 PM
Unknown Object (File)
Apr 4 2024, 5:14 AM
Unknown Object (File)
Mar 6 2024, 3:54 AM
Subscribers
None

Details

Summary

With React Native, it seems like the most popular QR generation library is react-native-qrcode-svg. It's not actively contributed on, but it's a pretty standardized implementation so that makes sense. Added benefits are:

  • Follows semver
  • Uses GitHub releases
  • A fair amount of customization options through props
  • MIT license

ENG-4610

Depends on D8821

Test Plan

Can successfully import the QRCode component on native

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Have you considered https://github.com/rosskhanas/react-qr-code? I found it on reactnative.directory. It looks like it's not quite as popular as react-native-qrcode-sv, but it's almost as popular, plus it works on both React and React Native and seems to have been updated more recently.

ashoat requested changes to this revision.Aug 16 2023, 1:03 PM

Passing back with question. Feel free to push back, I haven't compared these dependencies too closely

This revision now requires changes to proceed.Aug 16 2023, 1:03 PM

Yeah I've seen react-qr-code, I initially chose to not go with that as it seemed to be more of a 'barebones' QR code implementation. The main thing was if we wanted to add something like a logo or an image on the QR code down the line, the two packages (on web and here on native) support it, while react-qr-code doesn't.

More importantly though, it seems like react-qr-code uses qr.js underneath:

react-qr-code@2.0.12:
  version "2.0.12"
  resolved "https://registry.yarnpkg.com/react-qr-code/-/react-qr-code-2.0.12.tgz#98f99e9ad5ede46d73ab819e2dd9925c5f5d7a2d"
  integrity sha512-k+pzP5CKLEGBRwZsDPp98/CAJeXlsYRHM2iZn1Sd5Th/HnKhIZCSg27PXO58zk8z02RaEryg+60xa4vyywMJwg==
  dependencies:
    prop-types "^15.8.1"
    qr.js "0.0.0"

It seems to be completely unmaintained for the past several years: https://blog.sonatype.com/researcher-takes-over-qr.js-via-repo-hijacking.-is-the-npm-package-safe. The author of qrcode.react (the package we used for web) even decided to move away from using it

I think it's better to stay with the two packages that don't rely on qr.js, but ultimately happy to go with it if you think otherwise

Going to request review just so the discussion doesn't get lost. If you want to go with the react-qr-code package feel free to request changes again

rationale makes sense to me

Thanks for explaining!

This revision is now accepted and ready to land.Aug 18 2023, 4:00 PM
This revision was landed with ongoing or failed builds.Aug 22 2023, 8:19 AM
This revision was automatically updated to reflect the committed changes.