react-native-text-reader 1.2.0 → 1.3.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.
|
@@ -119,29 +119,24 @@ class TextReaderModule(reactContext: ReactApplicationContext) :
|
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
@ReactMethod
|
|
123
122
|
fun read(url: String, options: ReadableMap?, promise: Promise) {
|
|
124
123
|
try {
|
|
125
124
|
val script = options?.getString("script")
|
|
126
125
|
|
|
127
126
|
val image = getInputImage(reactApplicationContext, url)
|
|
128
|
-
|
|
129
127
|
val options = getScriptTextRecognizerOptions(script)
|
|
130
128
|
|
|
131
129
|
val recognizer: TextRecognizer = TextRecognition.getClient(options)
|
|
132
130
|
|
|
133
131
|
recognizer.process(image)
|
|
134
132
|
.addOnSuccessListener { visionText ->
|
|
135
|
-
val
|
|
136
|
-
result.putString("text", visionText.text)
|
|
137
|
-
|
|
138
|
-
val blocksArray = Arguments.createArray()
|
|
133
|
+
val linesArray = Arguments.createArray()
|
|
139
134
|
visionText.textBlocks.forEach { block ->
|
|
140
|
-
|
|
135
|
+
block.lines.forEach { line ->
|
|
136
|
+
linesArray.pushString(line.text)
|
|
137
|
+
}
|
|
141
138
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
promise.resolve(result)
|
|
139
|
+
promise.resolve(linesArray)
|
|
145
140
|
}
|
|
146
141
|
.addOnFailureListener { e ->
|
|
147
142
|
e.printStackTrace()
|
package/ios/TextReader.swift
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-text-reader",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.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",
|