react-native-qrcode-scanner icon indicating copy to clipboard operation
react-native-qrcode-scanner copied to clipboard

Can the dimensions of the camera scanner become smaller when in a smaller View?

Open afilp opened this issue 6 years ago • 9 comments

I have added the QRCodeScanner inside a View which is around 1/3 of the page height (and almost 100% of the page width).

I noticed that the marker is still large and that the detection of the QR is better on a corner than in the middle. Also the scanner requires more space and makes the ScrollView have a scrollbar.

I added width, height props to cameraStyle, is this the correct approach? The marker is still very large (part of it shows out of the view). Is the QR detection depended on that?

afilp avatar Jan 10 '18 21:01 afilp

I am also facing a similar issue.. I want my scanner to be 80% of my device's width and have margin around my qr scanner.. but I dont succeed to do that.. even when I pass marginRight, marginLeft to different props like style, container style etc.. nothing helps..

sarahmarciano avatar Feb 21 '18 10:02 sarahmarciano

Open to PRs implementing the feature, thanks! :)

moaazsidat avatar Feb 25 '18 05:02 moaazsidat

I'm struggling with this too, added height and width to cameraStyle but it seems to do nothing, it's still overly large and covering other content outside of the view it's in.

imvv avatar Oct 03 '18 13:10 imvv

Facing the same issue, any luck on this?

YogeshYo avatar Apr 29 '19 14:04 YogeshYo

After having various sizing/styling issues with this package, I switched to https://github.com/react-native-community/react-native-camera which also supports (qr|bar)code scanning. Might be worth a try @YogeshYo .

rszalski avatar Apr 29 '19 14:04 rszalski

Thanks @rszalski, I will try this and I agree with your solution. Thanks Again

YogeshYo avatar Apr 30 '19 13:04 YogeshYo

🧐🧐🧐🧐I really wish I knew this component was unable to be styled at all before I implemented it in my project.

running0x avatar Feb 04 '20 20:02 running0x

In my case, with the help of 'containerStyle' prop, I'm able to put marginTop and it's working though I'm not able to set the height of the camera if I try to put, it overlaps on other elements. Can somebody help with setting the height of the camera?

VSV6 avatar Sep 29 '20 10:09 VSV6

hey all, you can use cameraViewDimensions prop like the following: cameraViewDimensions={{ width: '90%', height:'60%', }} and cameraProps={{ ratio:'1:1' }}

cameraViewDimensions is a must to implement incase of android for react-native-camera, and as qrscanner is based on it so you have to use it as well, hope that helps

ManarHussein avatar Dec 21 '22 16:12 ManarHussein