11import { useImperativeHandle , useRef } from 'react'
22
3+ import { Background } from './components/background'
34import { DataModules } from './components/data-modules'
45import { FinderPatternsInner } from './components/finder-patterns-inner'
56import { FinderPatternsOuter } from './components/finder-patterns-outer'
67import { Gradient } from './components/gradient'
78import {
8- DEFAULT_BGCOLOR ,
9+ DEFAULT_FILENAME ,
910 DEFAULT_LEVEL ,
1011 DEFAULT_MINVERSION ,
1112 DEFAULT_SIZE ,
@@ -21,7 +22,7 @@ const ReactQRCode = (props: ReactQRCodeProps) => {
2122 value,
2223 size = DEFAULT_SIZE ,
2324 level = DEFAULT_LEVEL ,
24- bgColor = DEFAULT_BGCOLOR ,
25+ background ,
2526 gradient,
2627 minVersion = DEFAULT_MINVERSION ,
2728 boostLevel,
@@ -48,7 +49,7 @@ const ReactQRCode = (props: ReactQRCodeProps) => {
4849 useImperativeHandle ( ref , ( ) => ( {
4950 svg : svgRef . current ,
5051 download : ( {
51- name : fileName = 'qr-code' ,
52+ name : fileName = DEFAULT_FILENAME ,
5253 format : fileFormat = 'svg' ,
5354 size : fileSize = 500 ,
5455 } : DownloadOptions ) => {
@@ -111,7 +112,7 @@ const ReactQRCode = (props: ReactQRCodeProps) => {
111112 { ...svgProps }
112113 >
113114 < Gradient gradient = { gradient } />
114- < path fill = { bgColor } d = { `M0,0 h ${ numCells } v ${ numCells } H0z` } />
115+ < Background background = { background } numCells = { numCells } />
115116 < FinderPatternsOuter settings = { finderPatternOuterSettings } { ...svgElementsProps } />
116117 < FinderPatternsInner settings = { finderPatternInnerSettings } { ...svgElementsProps } />
117118 < DataModules settings = { dataModulesSettings } { ...svgElementsProps } />
0 commit comments