mrousavy / react-native-vision-camera

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

🐛 Unable to read Code 128 type barcodes #3258

Open JanilleOlegario opened 2 days ago

JanilleOlegario commented 2 days ago

What's happening?

Hello!

I am trying to scan a Code 128 type of barcode but it's not recognized on the camera.

Here is a sample of the barcode.

Screenshot 2024-10-23 at 7 48 27 PM

Type upc-a is perfectly working.

Can someone please help me? Thanks in advance!

Reproduceable Code

import {
  Camera,
  useCameraDevice,
  useCameraPermission,
  useCodeScanner,
} from 'react-native-vision-camera';  

const codeScanner = useCodeScanner({
    codeTypes: [
      'upc-a',
      'aztec',
      'codabar',
      'code-128',
      'code-39',
      'code-93',
      'data-matrix',
      'ean-13',
      'ean-8',
      'itf',
      'pdf-417',
      'qr',
      'upc-e',
    ],
    onCodeScanned: codes => {
      // console.log(`Scanned ${codes} codes!`);
      console.log(`Scanned ${JSON.stringify(codes)} codes!`);

      console.log(
        'test!!!',
        JSON.stringify(device, (k, v) => (k === 'formats' ? [] : v), 2),
      );

      const barcodeResult = codes.map(result => {
        return result.value;
      });

      console.log('test', barcodeResult[0]);

      setBarcodeText(barcodeResult[0]);
      setValue('orderId', barcodeResult[0]);
    },
  });

<Camera
   style={styles.camera}
   device={device}
   isActive={true}
   codeScanner={codeScanner}
/>

Relevant log output

> Configure project :react-native-vision-camera
[VisionCamera] Thank you for using VisionCamera ❤️
[VisionCamera] If you enjoy using VisionCamera, please consider sponsoring this project: https://github.com/sponsors/mrousavy
[VisionCamera] node_modules found at /Users/NAME/Desktop/PROJECT/marketplace/node_modules
[VisionCamera] VisionCamera_enableFrameProcessors is set to true!
[VisionCamera] react-native-worklets-core not found, Frame Processors are disabled!
[VisionCamera] VisionCamera_enableCodeScanner is set to true!

Camera Device

"formats": [],
  "sensorOrientation": "landscape-left",
  "hardwareLevel": "limited",
  "maxZoom": 4,
  "minZoom": 1,
  "maxExposure": 20,
  "supportsLowLightBoost": false,
  "neutralZoom": 1,
  "physicalDevices": [
    "wide-angle-camera"
  ],
  "supportsFocus": true,
  "supportsRawCapture": false,
  "isMultiCam": false,
  "minFocusDistance": 10,
  "minExposure": -20,
  "name": "0 (BACK) androidx.camera.camera2",
  "hasFlash": true,
  "hasTorch": true,
  "position": "back",
  "id": "0"

Device

Samsung Galaxy A34 5G

VisionCamera Version

"react-native-vision-camera": "^4.3.2"

Can you reproduce this issue in the VisionCamera Example app?

Yes, I can reproduce the same issue in the Example app here

Additional information

maintenance-hans[bot] commented 2 days ago

Guten Tag, Hans here! 🥨

It looks like you have quite a detailed report here, which is great! However, we still need to make sure we have all ze relevant information. You mentioned that you can reproduce ze issue in ze Example app, but it would be very helpful if you could provide logs from there.

You can gather logs using adb logcat for Android, which might show us why ze Code 128 barcodes aren't detected. It's important for mrousavy to have those logs to investigate further.

And remember, feel free to support ze project by sponsoring mrousavy here if you find it useful!

Looking forward to your updates!

Note: If you think I made a mistake, please ping @mrousavy to take a look.