File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5858 "react-dom" : " ^19.0.0" ,
5959 "typescript" : " ~5.7.3" ,
6060 "typescript-eslint" : " ^8.25.0" ,
61- "vite" : " ^6.1.1 " ,
61+ "vite" : " ^6.2.0 " ,
6262 "vite-plugin-dts" : " ^4.5.0"
6363 }
6464}
Original file line number Diff line number Diff line change 1- import { useImperativeHandle , useRef } from 'react'
1+ import { forwardRef , useImperativeHandle , useRef } from 'react'
22
33import { Background } from './components/background'
44import { DataModules } from './components/data-modules'
@@ -13,13 +13,12 @@ import {
1313} from './constants'
1414import { useIds } from './hooks/use-ids'
1515import { useQRCode } from './hooks/use-qr-code'
16- import type { DownloadOptions , ReactQRCodeProps } from './types/lib'
16+ import type { DownloadOptions , ReactQRCodeProps , ReactQRCodeRef } from './types/lib'
1717import { downloadRaster , downloadSVG } from './utils/download'
1818import { excavateModules } from './utils/qr-code'
1919
20- const ReactQRCode = ( props : ReactQRCodeProps ) => {
20+ const ReactQRCode = forwardRef < ReactQRCodeRef , ReactQRCodeProps > ( ( props , ref ) => {
2121 const {
22- ref,
2322 value,
2423 size = DEFAULT_SIZE ,
2524 level = DEFAULT_LEVEL ,
@@ -125,7 +124,7 @@ const ReactQRCode = (props: ReactQRCodeProps) => {
125124 { image }
126125 </ svg >
127126 )
128- }
127+ } )
129128
130129ReactQRCode . displayName = 'ReactQRCode'
131130
Original file line number Diff line number Diff line change @@ -109,7 +109,6 @@ export interface ReactQRCodeRef {
109109}
110110
111111export interface ReactQRCodeProps {
112- ref ?: React . Ref < ReactQRCodeRef >
113112 /**
114113 * The value to encode into the QR Code. An array of strings can be passed in
115114 * to represent multiple segments to further optimize the QR Code.
You can’t perform that action at this time.
0 commit comments