diff --git a/README.md b/README.md
index a56f1da..e6933cc 100644
--- a/README.md
+++ b/README.md
@@ -64,6 +64,7 @@ maskPattern | undefined | number |[Descript
toSJISFunc | undefined | function |[Description](https://github.com/soldair/node-qrcode#tosjisfunc)
errorCorrectionLevel | 'M' | 'L' \| 'M' \| 'Q' \| 'H' |[Description](https://github.com/soldair/node-qrcode#errorCorrectionLevel)
renderCustomPieceItem | undefined | [RenderCustomPieceItem](#RenderCustomPieceItem) | Render custom piece of QR code. It must return svg component. If it defined, previous piece and eyes configurations won't be work
+renderBackground | undefined | (pieceSize: number, bitMatrix: number[][]) => SvgProps['children'] | Ability to add any additional svg components behind qr code
children | undefined | (pieceSize: number, bitMatrix: number[][]) => SvgProps['children'] | Ability to add any additional svg components as children
...rest `` props |
diff --git a/example/src/examples/DownloadQR.tsx b/example/src/examples/DownloadQR.tsx
index 9d4022b..2f229fd 100644
--- a/example/src/examples/DownloadQR.tsx
+++ b/example/src/examples/DownloadQR.tsx
@@ -1,10 +1,11 @@
import React, { useRef } from 'react';
import { StyleSheet, View, Pressable, Text, Alert } from 'react-native';
-import QRCodeStyled from 'react-native-qrcode-styled';
+import QRCodeStyled, { SVGGradient, SVGQRCodeStyledProps } from 'react-native-qrcode-styled';
import * as FileSystem from 'expo-file-system';
import * as MediaLibrary from 'expo-media-library';
+import { Defs, Rect } from 'react-native-svg';
// also need to add MEDIA_LIBRARY permission for android
// https://docs.expo.dev/versions/latest/sdk/media-library/#configuration-in-appjsonappconfigjs
@@ -38,9 +39,40 @@ export default function DownloadQR() {
}
};
+ const renderBackground: SVGQRCodeStyledProps['renderBackground'] = (pieceSize, matrix) => {
+ const size = matrix.length * pieceSize + 50;
+
+ return (
+ <>
+
+
+
+
+
+ >
+ );
+ };
+
return (
-
+
SvgProps['children'];
+ renderBackground?: (pieceSize: number, bitMatrix: BitMatrix) => SvgProps['children'];
}
function SVGQRCodeStyled(
@@ -68,6 +69,7 @@ function SVGQRCodeStyled(
toSJISFunc,
errorCorrectionLevel = 'M',
children,
+ renderBackground,
...props
}: SVGQRCodeStyledProps,
ref?: ForwardedRef