-
Notifications
You must be signed in to change notification settings - Fork 26
Text Recognition #221
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
base: main
Are you sure you want to change the base?
Text Recognition #221
Conversation
🦋 Changeset detectedLatest commit: c335f27 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Hey @dccarmo - sorry for the long delay here. @frankcalise and I are going to review this sometime soon and get back to you. Appreciate the work! |
frankcalise
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey thanks for the submission, couple of things to take a look at here if you don't mind.
| const result = await launchImageLibrary({ | ||
| mediaType: "photo", | ||
| }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did we need to add react-native-image-picker for this over expo-image-picker? Does this one do something differently that you needed?
|
|
||
| struct TextRecord: Record { | ||
| @Field var text: String = "" | ||
| @Field var textBlocks: [TextBlockRecord] = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can rename this to blocks to match the API docs more closely.
| @Field var textBlocks: [TextBlockRecord] = [] | |
| @Field var blocks: [BlockRecord] = [] |
| struct TextBlockRecord: Record { | ||
| @Field var text: String = "" | ||
| @Field var frame: RectRecord = RectRecord() | ||
| @Field var recognizedLanguage: String = "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What was the decision here to only return the first language code over retrieving the array as the data structure is documented?
| { | ||
| "permissions": { | ||
| "allow": [ | ||
| "WebFetch(domain:developers.google.com)" | ||
| ], | ||
| "deny": [], | ||
| "ask": [] | ||
| } | ||
| } No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: please remove this claude config - I don't want other people to get the same permissions you granted on your machine.
| <Text preset={"heading"} text="Text Recognition" /> | ||
| <Text style={$description}>Take a photo, and extract text from it.</Text> | ||
| </View> | ||
| <ImageSelector |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: did you mean to include taking pictures? Looks like this is just an image select:
ScreenRecording_11-11-2025.14-29-25_1.MP4
| [], | ||
| ) | ||
|
|
||
| useEffect(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
|
||
| // Ensures backward compatibility | ||
| ext.getKotlinVersion = { | ||
| if (ext.has("kotlinVersion")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: @dccarmo - did you test this out on Android? I hit this build error:
> Task :expo-modules-core:compileDebugKotlin FAILED
e: This version (1.5.14) of the Compose Compiler requires Kotlin version 1.9.24 but you appear to be using Kotlin version 1.9.25 which is not known to be compatible. Please consult the Compose-Kotlin compatibility map located at https://developer.android.com/jetpack/androidx/releases/compose-kotlin to choose a compatible version pair (or `suppressKotlinVersionCompatibilityCheck` but don't say I didn't warn you!).
Do you have any screen recordings of it building on your end? I haven't been able to get this to build, and it does build on main.
I suspect the changes to apps/ExampleApp/package.json are part of the problem here. Can we try a smaller set of dependency changes in this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@frankcalise and I hit this when upgrading to Expo 53 - might be an Expo modules core issue. Wanna try bumping that version in your module to make sure it matches what we have for other modules on Expo 52?
| "@infinitered/react-native-mlkit-image-labeling": "workspace:^3.1.0", | ||
| "@infinitered/react-native-mlkit-object-detection": "workspace:^3.1.0", | ||
| "@react-native-async-storage/async-storage": "^2.0.0", | ||
| "@infinitered/react-native-mlkit-text-recognition": "workspace:^1.0.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: I don't think we need all the changes here, and it might be breaking our Android builds. Can we revisit these changes to a minimal set of dependency upgrades?

Description
Closes #210
This PR adds initial support for MLKit Text Recognition v2 for both iOS and Android.
Please let me know if I missed any collaboration steps or if there's anything else that needs to be updated.
Future work