Migrate from react-native-qrcode-svg
- import QRCode from 'react-native-qrcode-svg';
+ import { QRCode } from 'patine-ui';
- <QRCode value={url} size={180} color="#111" backgroundColor="#fff" ecl="H" logo={logo} logoSize={40} quietZone={16} />
+ <QRCode value={url} size={180} color="#111" backgroundColor="#fff" errorCorrection="H" logo={<Image source={logo} style={{ width: 32, height: 32 }} />} logoSize={0.22} quietZone={2} />
| react-native-qrcode-svg | Patine UI |
|---|---|
value | value (UTF-8) |
size | size, quiet zone included |
color / backgroundColor | color / backgroundColor |
ecl | errorCorrection ('M', or 'H' with a logo) |
quietZone (px) | quietZone (modules, default 4) |
logo (image source) + logoSize (px) | logo (any node) + logoSize (share of the width) |
logoBackgroundColor / logoMargin / logoBorderRadius | the plate takes backgroundColor and the design's corner radius |
enableLinearGradient / linearGradient | — |
getRef → toDataURL | createQRCode(value) for the matrix, to draw an SVG or PDF yourself |
onError | onError |
QRCode draws with plain views, so it needs neither react-native-svg nor the qrcode package.
See all migration guides for other libraries, and Comparison for when another library is the better choice.