diff --git a/components/qrcode/__tests__/index.test.tsx b/components/qrcode/__tests__/index.test.tsx
index 6de938dab5..8cd91d3ce0 100644
--- a/components/qrcode/__tests__/index.test.tsx
+++ b/components/qrcode/__tests__/index.test.tsx
@@ -79,4 +79,13 @@ describe('QRCode test', () => {
'ant-qrcode-borderless',
);
});
+
+ it('should console Error when icon exist && errorLevel is `L`', () => {
+ const errSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
+ render();
+ expect(errSpy).toHaveBeenCalledWith(
+ 'Warning: [antd: QRCode] ErrorLevel `L` is not recommended to be used with `icon`, for scanning result would be affected by low level.',
+ );
+ errSpy.mockRestore();
+ });
});
diff --git a/components/qrcode/demo/customSize.tsx b/components/qrcode/demo/customSize.tsx
index 35b06fff45..d1ee8f6fa9 100644
--- a/components/qrcode/demo/customSize.tsx
+++ b/components/qrcode/demo/customSize.tsx
@@ -36,6 +36,7 @@ const App: React.FC = () => {
(
diff --git a/components/qrcode/index.tsx b/components/qrcode/index.tsx
index eec3f9e27f..b47d7da928 100644
--- a/components/qrcode/index.tsx
+++ b/components/qrcode/index.tsx
@@ -59,6 +59,14 @@ const QRCode: React.FC = (props) => {
return null;
}
+ if (process.env.NODE_ENV !== 'production') {
+ warning(
+ !(icon && errorLevel === 'L'),
+ 'QRCode',
+ 'ErrorLevel `L` is not recommended to be used with `icon`, for scanning result would be affected by low level.',
+ );
+ }
+
const cls = classNames(prefixCls, className, hashId, {
[`${prefixCls}-borderless`]: !bordered,
});
diff --git a/components/qrcode/interface.ts b/components/qrcode/interface.ts
index 3371e02035..bebeeacd78 100644
--- a/components/qrcode/interface.ts
+++ b/components/qrcode/interface.ts
@@ -12,7 +12,6 @@ interface ImageSettings {
interface QRProps {
value: string;
size?: number;
- level?: string;
color?: string;
style?: CSSProperties;
includeMargin?: boolean;