jamenamcinteer / react-qr-barcode-scanner

A simple React Component using the client's webcam to read barcodes.
69 stars 71 forks source link

Video height is not taking full screen in mobile devices #22

Closed sksurendrakmr closed 2 years ago

sksurendrakmr commented 2 years ago

Video (Webcam) not taking full parent dimension height and has some ratio restriction in mobile screen

I have tried setting 1.) <BarcodeScannerComponent height="100vh" width="100%" ....../> 2.) <BarcodeScannerComponent height="100vh" width="100vw" ...../>

So Need to pass some style property to webcam component but right now we don't have any way to pass style property and overwrite some of CSS styles in webcam

with default height and width image

with height 100vh image

sksurendrakmr commented 2 years ago

Resolved the issue. All we have to do is apply the css properties in video tag. As under the hood, react-webcam rendering a video tag to enable the camera.

.video {
 height:'100vh';
 width:'100%';
 position:'fixed';
 bottom:0;
 top:0;
 left:0;
 objectFit:'cover';
}
xpcrts commented 1 year ago

can you help share the javascript code sample? @sksurendrakmr

xpcrts commented 1 year ago

where did you apply the css to connect with Javascript or React code? @sksurendrakmr