jonathanpalma / react-native-tesseract-ocr

Tesseract OCR wrapper for React Native
MIT License
561 stars 172 forks source link

TypeError: _reactNativeTesseractOcr.default.recognize is not a function #82

Closed mitesh-db closed 4 years ago

mitesh-db commented 4 years ago

Facing following error :

[TypeError: _reactNativeTesseractOcr.default.recognize is not a function. (In '_reactNativeTesseractOcr.default.recognize(path, _reactNativeTesseractOcr.LANG_ENGLISH, tesseractOptions)', '_reactNativeTesseractOcr.default.recognize' is undefined)]

Here is my code :

const recognizeTextFromImage = async (path) => {
    setIsLoading(true);

    try {
      const tesseractOptions = {};
      const recognizedText = await TesseractOcr.recognize(
        path,
        LANG_ENGLISH,
        tesseractOptions,
      );
      setText(recognizedText);
    } catch (err) {
      console.error(err);
      setText('');
    }

    setIsLoading(false);
    setProgress(0);
  };
jonathanpalma commented 4 years ago

@mitjnextt can you please provide react, react-native, and react-native-tesseract-ocr version?

mitesh-db commented 4 years ago

The versions are like this :

"react": "16.13.1",
"react-native": "0.63.1",
"react-native-tesseract-ocr": "^2.0.0",
jonathanpalma commented 4 years ago

@mitjnextt are you trying to use it on Android or iOS?

mitesh-db commented 4 years ago

@jonathanpalma Update on the issue: I have cleaned builds and now working on Android, getting scanned data in String

But on iOS, no luck even after cleaning build

mitesh-db commented 4 years ago

@jonathanpalma I think code you provided is working successfully but issue is in linking, Am I missing something on iOS?

jonathanpalma commented 4 years ago

@mitjnextt I am glad you were able to make it work on Android. Unfortunately, this library doesn't support iOS

mitesh-db commented 4 years ago

@jonathanpalma Oh okay, Thanks for the help