{"id":13905691,"url":"https://github.com/zsajjad/react-native-text-detector","last_synced_at":"2025-05-13T17:59:31.945Z","repository":{"id":57337623,"uuid":"140536530","full_name":"zsajjad/react-native-text-detector","owner":"zsajjad","description":"Text Detector from image for react native using firebase MLKit on android and Tesseract on iOS","archived":false,"fork":false,"pushed_at":"2019-11-26T13:13:40.000Z","size":236,"stargazers_count":223,"open_issues_count":25,"forks_count":60,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-04-30T23:41:32.602Z","etag":null,"topics":["core-ml","firebase-mlkit","react-native","tesseract-ios","tesseract-ocr","text-detection","vision"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zsajjad.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-07-11T07:15:31.000Z","updated_at":"2025-03-28T10:37:19.000Z","dependencies_parsed_at":"2022-08-29T21:10:30.246Z","dependency_job_id":null,"html_url":"https://github.com/zsajjad/react-native-text-detector","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zsajjad%2Freact-native-text-detector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zsajjad%2Freact-native-text-detector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zsajjad%2Freact-native-text-detector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zsajjad%2Freact-native-text-detector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zsajjad","download_url":"https://codeload.github.com/zsajjad/react-native-text-detector/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253638866,"owners_count":21940433,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["core-ml","firebase-mlkit","react-native","tesseract-ios","tesseract-ocr","text-detection","vision"],"created_at":"2024-08-06T23:01:21.317Z","updated_at":"2025-05-13T17:59:31.746Z","avatar_url":"https://github.com/zsajjad.png","language":"Java","funding_links":[],"categories":["Java"],"sub_categories":[],"readme":"# React Native Text Detector\n\n[![npm](https://img.shields.io/npm/dm/react-native-text-detector.svg)](https://www.npmjs.com/package/react-native-text-detector)\n\n\n## See it in action\nCheckout these blog for \n- [Business Card Reading App](https://heartbeat.fritz.ai/building-text-detection-apps-for-ios-and-android-using-react-native-42fe3c7e339) \n- [Delta ML - Comparison between different OCR SDKs (iOS)](https://heartbeat.fritz.ai/comparing-on-device-text-recognition-ocr-sdks-24f8a0423461)\n- [Choose the Right On-Device Text Recognition (OCR) SDK on Android Using DeltaML](https://heartbeat.fritz.ai/https-heartbeat-fritz-ai-choose-the-right-on-device-text-recognition-sdk-on-android-using-deltaml-9b4b3e409b6e)\n\nfor example of this package.\n\n## Different libraries\nDefault branch uses Tesseract on iOS and Firebase ML Kit on android. Beside that we have 2 branches\n\n- [Firebase](https://github.com/zsajjad/react-native-text-detector/tree/firebase) it uses firebase on both platforms\n- [Tesseract OCR](https://github.com/zsajjad/react-native-text-detector/tree/tesseract) it uses tesseract on both platforms\n\nFor deciding between which one is better check this blog on [Hearbeat by Fritz.ai](https://heartbeat.fritz.ai/comparing-on-device-text-recognition-ocr-sdks-24f8a0423461)\n\n## Getting started\n\n`$ npm install react-native-text-detector --save` or `yarn add react-native-text-detector`\n\n### Manual installation\n\n#### iOS\n\n##### Attach Tesseract Languages you want to use in your app \n\nImport your tessdata folder (you can download one for your language from [Google's Repo](https://code.google.com/p/tesseract-ocr/downloads/list) OR if that gives an error use [THIS REPO](https://github.com/tesseract-ocr/tessdata/tree/bf82613055ebc6e63d9e3b438a5c234bfd638c93) as referenced on [stack overflow as solution](https://stackoverflow.com/questions/41131083/tesseract-traineddata-not-working-in-swift-3-0-project-using-version-4-0/41168236#41168236) into the root of your project AS A REFERENCED FOLDER (see below). It contains the Tesseract trained data files. You can add your own trained data files here too.\n\nNOTE: This library currently requires the tessdata folder to be linked as a referenced folder instead of a symbolic group. If Tesseract can't find a language file in your own project, it's probably because you created the tessdata folder as a symbolic group instead of a referenced folder. It should look like this if you did it correctly:\n\n![alt text](https://cloud.githubusercontent.com/assets/817753/4598582/aeba675c-50ba-11e4-8d14-c7af9336b965.png \"guide\")\n\nNote how the tessdata folder has a blue icon, indicating it was imported as a referenced folder instead of a symbolic group.\n\n##### Also add `-lstdc++` if not already present\n\n##### Using Pods (Recommended)\n1. Add following in `ios/Podfile` \n```ruby\n    pod 'RNTextDetector', path: '../node_modules/react-native-text-detector/ios'\n```\n2. Run following from project's root directory\n```bash\n    cd ios \u0026\u0026 pod install\n```\n3. Use `\u003cyour_project\u003e.xcworkspace` to run your app\n\n##### Direct Linking\n1.  In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]`\n2.  Go to `node_modules` ➜ `react-native-text-detector` and add `RNTextDetector.xcodeproj`\n3.  In XCode, in the project navigator, select your project. Add `libRNTextDetector.a` to your project's `Build Phases` ➜ `Link Binary With Libraries`\n4.  Run your project (`Cmd+R`)\u003c\n\n#### Android\n\nThis package uses Firebase ML Kit for text recognition on android please make sure you have integrated firebase in your app before started integration of this package. [Here is the guide](https://firebase.google.com/docs/android/setup) for Firebase integration.\n\n1.  Open up `android/app/src/main/java/[...]/MainApplication.java`\n\n- Add `import com.fetchsky.RNTextDetector.RNTextDetectorPackage;` to the imports at the top of the file\n- Add `new RNTextDetectorPackage()` to the list returned by the `getPackages()` method\n\n2.  Append the following lines to `android/settings.gradle`:\n    ```\n    include ':react-native-text-detector'\n    project(':react-native-text-detector').projectDir = new File(rootProject.projectDir, \t'../node_modules/react-native-text-detector/android')\n    ```\n3.  Insert the following lines inside the dependencies block in `android/app/build.gradle`:\n\n    ```\n    ...\n    dependencies {\n        implementation 'com.google.firebase:firebase-core:16.0.1'\n        implementation 'com.google.firebase:firebase-ml-vision:17.0.0'\n\n        implementation (project(':react-native-text-detector')) {\n            exclude group: 'com.google.firebase'\n        }\n    }\n\n    // Place this line at the end of file\n\n    apply plugin: 'com.google.gms.google-services'\n\n    // Work around for onesignal-gradle-plugin compatibility\n    com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true\n    ```\n\n4.  Insert the following lines inside the dependencies block in `android/build.gradle`:\n\n    ```\n    buildscript {\n        repositories {\n            google()\n            ...\n        }\n        dependencies {\n            classpath 'com.android.tools.build:gradle:3.0.1'\n            classpath 'com.google.gms:google-services:4.0.1' // google-services plugin\n        }\n    }\n    ```\n\n## Usage\n\n```javascript\n/**\n *\n * This Example uses react-native-camera for getting image\n *\n */\n\nimport RNTextDetector from \"react-native-text-detector\";\n\nexport class TextDetectionComponent extends PureComponent {\n  ...\n\n  detectText = async () =\u003e {\n    try {\n      const options = {\n        quality: 0.8,\n        base64: true,\n        skipProcessing: true,\n      };\n      const { uri } = await this.camera.takePictureAsync(options);\n      const visionResp = await RNTextDetector.detectFromUri(uri);\n      console.log('visionResp', visionResp);\n    } catch (e) {\n      console.warn(e);\n    }\n  };\n\n  ...\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzsajjad%2Freact-native-text-detector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzsajjad%2Freact-native-text-detector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzsajjad%2Freact-native-text-detector/lists"}