-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not compatible with React Native: "Can't find variable: document" #709
Comments
|
I think this is the same issue I am having here.
|
A reproduction can be found here. |
@danyhiol I tried using your repo, and it worked without throwing any such error. The following text was printed.
If this repo produces an error, please provide instructions detailed enough that somebody with no experience with your project or React Native could reproduce. |
@Balearica did you run it on the
|
@danyhiol Thank you for the more detailed instructions, I was able to replicate this issue. We do not reference |
I looked more into what React Native is, and it is fundamentally at odds with what Tesseract.js is. Tesseract.js is a webassembly port of Tesseract. React Native does not support webassembly. This was noted in #55, and it does not look like anything has changed since. I updated the README to more clearly state that Tesseract.js is a webassembly port of Tesseract, as well as adding a line that explicitly states it does not support React Native. Hopefully this will avoid future confusion. |
Im new to react Native but I have more than 10 years of experience using JS.
for some reason, when I call the tesseract.recognize() I am getting a console warning (mentioned above) and no output.
Here are the steps that I followed:
first, navigated to the project -> npm install tesseract.js ( according to the description, would give the latest version)
then, created the following method:
process = function() { const { createWorker } = require('tesseract.js'); const worker = await createWorker(); (async () => { await worker.loadLanguage('eng'); await worker.initialize('eng'); const { data: { text } } = await worker.recognize('https://tesseract.projectnaptha.com/img/eng_bw.png'); Alert.alert(text); await worker.terminate(); })(); };
and then calling this method as a callback from a button onclick event.
Im using running it on an iOS device.
The text was updated successfully, but these errors were encountered: