Search code examples
react-nativereact-native-firebasefirebase-mlkit

react-native-firebase-mlkit textRecognizerProcessImage is not a function


After installing react native-firebase core app and mlkit. mlkit does not work and fails when I try to use the function textRecognizerProcessImage.

I followed: https://invertase.io/oss/react-native-firebase/v6/ml-vision/quick-start and additionally for ios I did an pod install and saw how mlkit was downloaded. However, the error from above occurs on android and ios. Does anybody have a clue?

EDIT: I am also having access to the firebase-project using google-services.jsonand googleservice-info.plist

the relevant part from my package.json. Am using newest versions for all. (As you can see I am also using /auth and /database both of which work just fine!

"dependencies": {
    "@react-native-firebase/app": "^6.0.0",
    "@react-native-firebase/auth": "^6.0.0",
    "@react-native-firebase/database": "^6.0.0",
    "@react-native-firebase/ml-vision": "^6.0.0",
    "react": "16.9.0",
    "react-native": "0.61.1"
  },

the firebase.json:

{
  "react-native": {
    "ml_vision_face_model": true,
    "ml_vision_ocr_model": true,
    "ml_vision_barcode_model": true,

    "ml_vision_label_model": true,
    "ml_vision_image_label_model": true
  }
}


Solution

  • simple solution... The documentation talks about

    import vision from '@react-native-firebase/ml-vision';

    to import the vision library. However, vision.anyFunctionHere will not work, since it is no instance.

    the solution is to use vision().anyFunctionHere (not the brackets of doom which cost me hours and a hell lot of frustration-.-)