feat: complete New Architecture (Turbo Modules) support for Android & IOS, closes #85#86
Open
J4cKr0y wants to merge 1 commit intoa7medev:mainfrom
Open
feat: complete New Architecture (Turbo Modules) support for Android & IOS, closes #85#86J4cKr0y wants to merge 1 commit intoa7medev:mainfrom
J4cKr0y wants to merge 1 commit intoa7medev:mainfrom
Conversation
…ackward compatibility
Migrate @react-native-ml-kit/text-recognition to the React Native New
Architecture (JSI/TurboModules) while preserving full support for the
old Bridge-based architecture.
Android:
- TextRecognitionModule now extends NativeTextRecognitionSpec (Codegen)
instead of ReactContextBaseJavaModule � business logic unchanged
- TextRecognitionPackage split into two sourcesets:
src/newarch/ ? extends TurboReactPackage (New Arch)
src/oldarch/ ? implements ReactPackage (Old Arch)
- build.gradle updated with isNewArchitectureEnabled() guard and
Codegen configuration
iOS:
- Add RNTextRecognition.h/.mm implementing the MLKit text recognition
logic in Objective-C++
- getTurboModule() wired behind #ifdef RCT_NEW_ARCH_ENABLED � no impact
on old arch builds
- text-recognition.podspec updated with conditional New Arch dependencies
(React-Codegen, RCT-Folly, ReactCommon/turbomodule/core)
JS:
- Add NativeTextRecognition.ts as the Codegen spec (source of truth)
- Add src/index.ts with dual-arch routing via global.__turboModuleProxy
Tests:
- TextRecognitionModuleTest.java (JUnit 4 + Mockito + Robolectric)
- RNTextRecognitionTests.swift (XCTest)
- textRecognition.test.ts (Jest) covering result structure, script
parameter, error propagation, and dual-arch routing
Tooling:
- Replace deprecated babel-preset-react-native with
metro-react-native-babel-preset
- Add babel.config.js, tsconfig.json, jest.setup.js
- Add TESTING.md with setup instructions for all three platforms
BREAKING CHANGE: none � old arch users are unaffected
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Feat(android, ios): migrate to New Architecture (TurboModules) with backward compatibility
Migrate @react-native-ml-kit/text-recognition to the React Native New Architecture (JSI/TurboModules) while preserving full support for the old Bridge-based architecture.
Android:
iOS:
JS:
Tests:
Tooling:
BREAKING CHANGE: none. Old arch users are unafected.