I'm building a React Native app that uses the react-native-vision-camera package for face detection. I've also installed vision-camera-face-detector package to enable face detection. However, when I try to run the app and use the scanFaces function from vision-camera-face-detector, I get the error "Can't find variable: __scanFaces" in my Frame Processor.
import { scanFaces } from "vision-camera-face-detector";
const frameProcessor = useFrameProcessor((frame) => {
const scannedFaces = scanFaces(frame);
if (scannedFaces.length) {
runOnJS(setFaces)(scannedFaces);
}
}, []);
My babel.config file looks like this:
module.exports = {
presets: ["module:metro-react-native-babel-preset", "module:react-native-dotenv"],
env: {
production: {},
},
plugins: [
[
"@babel/plugin-proposal-decorators",
{
legacy: true,
},
],
["@babel/plugin-proposal-optional-catch-binding"],
[
'react-native-reanimated/plugin',
{
globals: ['__scanFaces'],
},
], // NOTE: this must be last in the plugins
],
}
I'm currently using these versions:
`"react": "17.0.2",
"react-native": "^0.64.2", // migrated from 0.63.3 to 0.64.2 to install vision camera
"react-native-reanimated": "2.3.0-beta.2",
"react-native-vision-camera": "2.13.0",
"vision-camera-face-detector": "^0.1.7", // Tried "0.1.8" and "0.1.7" `