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

Camera preview seem `stretch`

Open phuhk opened this issue 6 years ago • 3 comments

Hi there, anyone notice about Camera preview? My app currently support switch between 2 mode standar Camera and this scan document camera. And I notice preview aspect ratio of this scan document camera seem stretch smaller size than standar camera.

phuhk avatar Jan 22 '19 04:01 phuhk

+1

mmamoyco avatar Feb 01 '19 10:02 mmamoyco

+1

igor90007 avatar Jul 29 '19 12:07 igor90007

The preview aspect ratio is a problem caused by Android having a preset list of available camera preview sizes. This means that you need to adjust the height and or width of the camera preview to match the aspect ratio (not just full screen). If you set flex: 1 on the scanner component, it will distort the preview. You will need to correct the aspect ratio by setting the width and height.

I noticed a lot of issues with this package which is why I completely rebuilt this package (both Android and iOS to fix this issue. I changed the API for this package to include a callback that gives you the aspect ratio percentages so you can address this issue. If you want a plug and play scanner, just look at the full example I give for this package, it shows how I handle this situation. Here's the link to it. It's react-native-rectangle-scanner on NPM.

https://github.com/HarvestProfit/react-native-rectangle-scanner

humphreyja avatar Jan 15 '20 23:01 humphreyja

Still having this issue. Any solutions for this stretched preview?

ertan95 avatar Feb 28 '24 21:02 ertan95