Closed thinkasany closed 7 months ago
I'm going to let CI run mostly so the failures are obvious. Please build and test changes before submitting.
But there are a dozen issues with the change as is. size
is used throughout as a number and you cannot just change the type in one place and hope for the best. You'd need to do a lot to make number | string
work. Canvas and SVG also have different considerations. Canvas is not vector based and can't just scale. In fact we specifically figure out pixel density of your screen when rendering to make it look good.
Now that said, you can use CSS to style what we render. We'll pass style
and className
and anything else through. I call this out in the readme with this very use case in mind. That comes with risks as mentioned with Canvas, but in your case with using SVG, just pass <QRCodeSVG {...realProps} style={{width: '100%', height: '100%'}} />
.
I modified the example code to show you:
You can actually see what it does to Canvas as well to illustrate my point:
While this proposed change isn't going to work I do appreciate you thinking about it and sending a PR. If there's anything else you may want or need out of this package, I'd love to hear.
The
size
of QRProps can be used with string type '100%', would like to take this pr, thanks a lot.