react-native-document-scanner
react-native-document-scanner copied to clipboard
Camera preview seem `stretch`
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.
+1
+1
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
Still having this issue. Any solutions for this stretched preview?