Open chaudev opened 2 years ago
Try adding one line to the file 'VisionCameraCodeScanner.m' as shown below.
@interface VISION_EXPORT_SWIFT_FRAME_PROCESSOR(scanCodes, VisionCameraCodeScanner) -(void)stub {} @end
Try adding one line to the file 'VisionCameraCodeScanner.m' as shown below.
@interface VISION_EXPORT_SWIFT_FRAME_PROCESSOR(scanCodes, VisionCameraCodeScanner) -(void)stub {} @EnD
Where is the path of this file?
One of the branches says that the fix was made in version 2.15.2, but I still have this error in android.
I still have this error running from the example, running in ios.
In my babel.config.js I have
plugins: [[ 'react-native-reanimated/plugin', { globals: ['__scanCodes'] } ]]
I put 'scanCodes' instead of 'scanQRCodes' and it works for me
the issue happens on Android with typescript enabled.
Note: I updated react native to 0.70.6 and the issue is resolved
"react-native": "0.70.6" "react-native-vision-camera": "2.15.2" "vision-camera-code-scanner": "^0.2.0", "react-native-reanimated": "^2.13.0"
Hello Everyone I faced with the same issue and solved like this:
import { Camera, useCameraDevices, useFrameProcessor } from 'react-native-vision-camera';
import { BarcodeFormat, scanBarcodes, Barcode } from 'vision-camera-code-scanner';
import 'react-native-reanimated';
import { runOnJS } from 'react-native-reanimated';
import React, { useState } from 'react';
import { View, StyleSheet } from 'react-native';
const MyComponent = () => {
const devices = useCameraDevices();
const device = devices.back;
const [barcodes, setBarcodes] = useState<Barcode[]>([]);
const frameProcessor = useFrameProcessor((frame) => {
'worklet';
const detectedBarcodes = scanBarcodes(frame, [BarcodeFormat.ALL_FORMATS], { checkInverted: true });
console.log(detectedBarcodes);
runOnJS(setBarcodes)(detectedBarcodes);
}, []);
return (
<View
style={{
flex: 1,
}}>
{device && (
<Camera style={StyleSheet.absoluteFill} device={device} frameProcessor={frameProcessor} isActive={true} frameProcessorFps={60} />
)}
</View>
);
};
export default MyComponent;
the point is I moved import reanimated into my component also changed FPS(frameProcessorFps) prop to 60 After that, I deleted node_modules, reinstalled and rebuild the app. So now it works fine for me
This problem has bothered me for a long time, after update react-native-vision-camera
to 2.15.2
, this error disappear.
Help me, please !!!
plugins: [ [ 'react-native-reanimated/plugin', { globals: ['__scanQRCodes'], }, ], ],
project.ext.react = [ enableHermes: false ]
project.ext.react = [ enableHermes: true ]
yarn start --reset-cache