Re-size react native qrcode-svg when displaying on different platforms

638 Views Asked by At

I'm trying to adjust the react native qrcode-svg size displayed on different platforms; mobile and on computer. However, I only seem to be able to put one static size, which 350, good for mobile but when displayed on the computer it looks giant and very uncomfortable to scan. I tried the Platform.OS function:

                  Platform.OS === "web"
                    ? 100
                    : Platform.OS === "android"
                    ? 350
                    : 100
                }

but i think since the app was implemented on mobile it doesn't work for me.

this is my qrcode component:

<QRCode
               value={codeValue}
               // size={
               //   Platform.OS === "web"
               //     ? 100
               //     : Platform.OS === "android"
               //     ? 350
               //     : 100
               // }
               size={350}
               getRef={(c) => {
                 svg = c;
               }}
             />

PS: i get my qr displayed image from: icon: 'data:image/png;base64,${dataURL}' I'm stuck with this since yesterday, if you have any hint, please help.

0

There are 0 best solutions below