vision-camera-code-scanner icon indicating copy to clipboard operation
vision-camera-code-scanner copied to clipboard

App crashes when i use this library without warning or error

Open gpoul1806 opened this issue 1 year ago • 10 comments

I use these modules: "react-native": "0.70.6", "react-native-vision-camera": "^2.15.2", "vision-camera-code-scanner": "^0.2.0"

And the app crashes without a warning or an error on the console! P.S. I have asked for camera permission earlier in the app.

Here is my code :

import { useScanBarcodes, BarcodeFormat } from 'vision-camera-code-scanner'; import TextRecognition from '@react-native-ml-kit/text-recognition';

const App = () => { const devices = useCameraDevices(); const device = devices.back; const camera = useRef(null);

const [frameProcessor, barcodes] = useScanBarcodes([BarcodeFormat.QR_CODE], {
    checkInverted: true,
});
    

return <Camera style={StyleSheet.absoluteFill} device={device} isActive={true} frameProcessor={frameProcessor} frameProcessorFps={5} /> }

gpoul1806 avatar Mar 30 '23 14:03 gpoul1806

Same Problem

Ho3ein-Boka avatar Apr 05 '23 08:04 Ho3ein-Boka

I am having the same problem, also react-native version "0.70.6"

rdelao avatar Apr 17 '23 22:04 rdelao

Same, but only on Android. iOS works for me

ray-holland-es avatar Apr 19 '23 20:04 ray-holland-es

Maybe merge this? https://github.com/rodgomesc/vision-camera-code-scanner/pull/138

ray-holland-es avatar Apr 19 '23 20:04 ray-holland-es

any update for this issue? still crashes tho, any help? @rodgomesc @ray-holland-es @gpoul1806

takeruadelbert avatar May 13 '23 08:05 takeruadelbert

any update for this issue? still crashes tho, any help? @rodgomesc @ray-holland-es @gpoul1806

after further debugging almost for a week,I got this solved by either upgrading the react-native-reanimated version or added config in android/build.gradle. in my case, the crash happened because of that dependency, not vision-camera-code-scanner.

takeruadelbert avatar May 18 '23 05:05 takeruadelbert

any update for this issue? still crashes tho, any help? @rodgomesc @ray-holland-es @gpoul1806

after further debugging almost for a week,I got this solved by either upgrading the react-native-reanimated version or added config in android/build.gradle. in my case, the crash happened because of that dependency, not vision-camera-code-scanner.

Can you share your react-native-reanimated version and your "added config in android/build.gradle? I has been encountering this issue. Thank you.

luatvudinh avatar May 30 '23 03:05 luatvudinh

any update for this issue? still crashes tho, any help? @rodgomesc @ray-holland-es @gpoul1806

after further debugging almost for a week,I got this solved by either upgrading the react-native-reanimated version or added config in android/build.gradle. in my case, the crash happened because of that dependency, not vision-camera-code-scanner.

Can you share your react-native-reanimated version and your "added config in android/build.gradle? I has been encountering this issue. Thank you.

@luatvudinh I was using react-native-reanimated version 2.14.1. in my case either upgrade to 2.14.2 or added this config for still using 2.14.1

project.ext.reanimated = [
    buildFromSource: true
]

you need to see what is the error first by debugging or displaying ADB log

takeruadelbert avatar Jun 01 '23 02:06 takeruadelbert

Fixed for us by not using the hook useScanBarcodes but second approach instead

// Alternatively you can use the underlying function:
  //
  // const frameProcessor = useFrameProcessor((frame) => {
  //   'worklet';
  //   const detectedBarcodes = scanBarcodes(frame, [BarcodeFormat.QR_CODE], { checkInverted: true });
  //   runOnJS(setBarcodes)(detectedBarcodes);
  // }, []);

most likely the reason is different versions of reanimated, though I don't have any proofs

professorkolik avatar Jun 06 '23 22:06 professorkolik

Maybe merge this? #138

This changes work for me. I had to apply them manually via patch-package.

rznzippy avatar Aug 08 '23 13:08 rznzippy