mrousavy / react-native-vision-camera

📸 A powerful, high-performance React Native Camera library.
https://react-native-vision-camera.com
MIT License
7.58k stars 1.1k forks source link

Cade Scanner doesn't scan codes on the left side of screen❓ #2236

Closed KingSharkG closed 10 months ago

KingSharkG commented 11 months ago

Question

I update my react-native app: react-native 0.69.1 -> 0.72 react-native-vision-camera 2.14.1 -> 3.6.12

Before updates I use vision-camera-code-scanner for scanning barcodes and scanner scan barcodes on full screen (and the issue was to create custom reaction zone) But after update the I set the regionOfInterest and it's not work. Also I found that on the left side of the screen zone where scanner not work (not matter use regionOfInterest or not)

The device.sensorOrientation landscape-right The screen orientation portrait

Use Android Emulator - Pixel_4_API_34

P.S. regionOfInterest - not work

Screenshot 2023-11-30 at 00 05 41 in red not scanned zone

What I tried

I tried to set the orientation in props of Camera not help. The start position of screen in top left side but start position of camera frame is top right side.

Frame: {"height": 720, "width": 1280}

Code usage:

const codeScanner = useCodeScanner({
    codeTypes: [
      'code-128',
      'code-39',
      'code-93',
      'codabar',
      'ean-13',
      'ean-8',
      'itf',
      'upc-e',
      'qr',
      'pdf-417',
      'aztec',
      'data-matrix',
    ],
    onCodeScanned: (codes, frame) => {
      console.log('🚀 ~ ScanBarcode ~ frame:', frame);

      console.log('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
      console.log('codes', codes.length);
      console.log('code', codes?.[0]);
      console.log('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
    },
    regionOfInterest: {
      x: layoutPosition.x,
      y: layoutPosition.y,
      width: layoutPosition.width,
      height: layoutPosition.height,
    },
  });

   <Camera
      style={StyleSheet.absoluteFill}
      device={device}
      isActive={isFocused}
      audio={false}
      orientation="portrait"
      codeScanner={codeScanner}
    />

VisionCamera Version

3.6.12

Additional information

KingSharkG commented 11 months ago

Still facing this issue

mrousavy commented 10 months ago

Hey! I think this has already been fixed. If not, feel free to re-open :)