Skip to content

Commit

Permalink
fix(rax-qrcode): fix qr code canvas layout
Browse files Browse the repository at this point in the history
  • Loading branch information
linbudu599 committed Aug 1, 2023
1 parent b975a45 commit fbe33d5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/rax-qrcode/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rax-qrcode",
"version": "2.1.0",
"version": "2.1.0-beta.0",
"description": "QRCode component for Rax.",
"license": "BSD-3-Clause",
"main": "lib/index.js",
Expand Down
6 changes: 4 additions & 2 deletions packages/rax-qrcode/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createElement, Component, createRef, RefObject } from 'rax';
import Canvas from 'rax-canvas';
import qr from 'qr.js';

enum ErrorCorrectLevelMap {
Expand Down Expand Up @@ -54,7 +55,8 @@ class QRCode extends Component<QRCodeProps, QRCodeState> {
}

public initCanvasLayoutAndDraw(data: string, options: QRCodeOptions) {
const canvasNode = this.canvas.current;
// @ts-expect-error
const canvasNode = this.canvas.current.canvas.current;

if (!canvasNode) return;

Expand Down Expand Up @@ -133,7 +135,7 @@ class QRCode extends Component<QRCodeProps, QRCodeState> {
public render() {
const { style } = this.props;
return (
<canvas
<Canvas
width={this.state.canvasWidth}
height={this.state.canvasHeight}
style={{ ...styles.qrCode, ...style }}
Expand Down

0 comments on commit fbe33d5

Please sign in to comment.