react-native-text-reader 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -63,7 +63,6 @@ android {
63
63
  defaultConfig {
64
64
  minSdkVersion getExtOrIntegerDefault("minSdkVersion")
65
65
  targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
66
-
67
66
  }
68
67
 
69
68
  buildTypes {
@@ -74,6 +73,7 @@ android {
74
73
 
75
74
  lintOptions {
76
75
  disable "GradleCompatible"
76
+ abortOnError false
77
77
  }
78
78
 
79
79
  compileOptions {
@@ -95,16 +95,16 @@ dependencies {
95
95
  //noinspection GradleDynamicVersion
96
96
  implementation "com.facebook.react:react-native:+"
97
97
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
98
-
98
+
99
99
  // To recognize Latin script
100
- implementation 'com.google.mlkit:text-recognition:16.0.0'
100
+ implementation 'com.google.mlkit:text-recognition:16.0.1'
101
101
  // To recognize Chinese script
102
- implementation 'com.google.mlkit:text-recognition-chinese:16.0.0'
102
+ implementation 'com.google.mlkit:text-recognition-chinese:16.0.1'
103
103
  // To recognize Devanagari script
104
- implementation 'com.google.mlkit:text-recognition-devanagari:16.0.0'
104
+ implementation 'com.google.mlkit:text-recognition-devanagari:16.0.1'
105
105
  // To recognize Japanese script
106
- implementation 'com.google.mlkit:text-recognition-japanese:16.0.0'
106
+ implementation 'com.google.mlkit:text-recognition-japanese:16.0.1'
107
107
  // To recognize Korean script
108
- implementation 'com.google.mlkit:text-recognition-korean:16.0.0'
108
+ implementation 'com.google.mlkit:text-recognition-korean:16.0.1'
109
109
  }
110
110
 
@@ -28,11 +28,10 @@ import com.google.mlkit.vision.text.latin.TextRecognizerOptions
28
28
  import java.io.IOException
29
29
  import java.net.URL
30
30
 
31
-
32
31
  class TextReaderModule(reactContext: ReactApplicationContext) :
33
32
  ReactContextBaseJavaModule(reactContext) {
34
- override fun getName(): String {
35
- return NAME
33
+ override fun getName(): String {
34
+ return "TextReader"
36
35
  }
37
36
 
38
37
  @Throws(IOException::class)
@@ -121,10 +120,12 @@ class TextReaderModule(reactContext: ReactApplicationContext) :
121
120
  }
122
121
 
123
122
  @ReactMethod
124
- fun read(url: String, script: String, promise: Promise) {
123
+ fun read(url: String, script: ReadableMap?, promise: Promise) {
125
124
  try {
126
125
  val image = getInputImage(reactApplicationContext, url)
127
- val options = getScriptTextRecognizerOptions(script)
126
+
127
+ val options = getScriptTextRecognizerOptions(script.toString())
128
+
128
129
  val recognizer: TextRecognizer = TextRecognition.getClient(options)
129
130
 
130
131
  recognizer.process(image)
@@ -149,8 +150,4 @@ class TextReaderModule(reactContext: ReactApplicationContext) :
149
150
  promise.reject("Text recognition failed", e)
150
151
  }
151
152
  }
152
-
153
- companion object {
154
- const val NAME = "TextReader"
155
- }
156
153
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-text-reader",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "A React Native library for OCR (Optical Character Recognition) using Vision Framework on iOS and Firebase ML Kit on Android.",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/commonjs/index.js",