React Native ML Kit
repository·main·Indexed 20 days ago
https://github.com/a7medev/react-native-ml-kitA collection of modules that bring Google's on-device machine learning capabilities to React Native applications. Supported features include barcode scanning, face detection, image labeling, text recognition (including non-Latin scripts), language identification, and text translation (alpha).
What's inside react-native-ml-kit
- React Native ML Kit provides on-device machine learning capabilities for React Native applications using Google ML Kit. It allows developers to integrate various computer vision and natural language processing features directly into their mobile apps.
Install @react-native-ml-kit/text-recognition
mainInstall the text recognition module using npm:
npm install @react-native-ml-kit/text-recognition --saveLinking
- React Native > 0.59: The module is automatically linked via the CLI autolink feature during the app build process.
- React Native <= 0.59: Manually link the module using:
react-native link @react-native-ml-kit/text-recognition
iOS Setup
On iOS, you must install the native pods using CocoaPods:
npx pod-installConfigure native linking for face-detection
mainDepending on your React Native version, follow the appropriate linking method:
- React Native > 0.59: The module uses CLI autolinking and will be linked automatically during the app build process.
- React Native <= 0.59: Manually link the module using the React Native CLI:
react-native link @react-native-ml-kit/face-detectionInstall iOS Pods for face-detection
mainOn iOS, you must add the native
RNMLKitFaceDetectiondependency to your project using CocoaPods:npx pod-installInstall @react-native-ml-kit/face-detection
mainInstall the face detection module using npm:
npm install @react-native-ml-kit/face-detection --saveConfigure native linking and Pods
mainLinking
- React Native > 0.59: The module is automatically linked using the CLI autolink feature during the app build process.
- React Native <= 0.59: Manually link the module using:
react-native link @react-native-ml-kit/translate-text
iOS Setup
On iOS, you must install the native CocoaPods dependencies by running:
npx pod-installnpx pod-installInstall @react-native-ml-kit/translate-text
mainInstall the package using npm to add it to your React Native project:
npm install @react-native-ml-kit/translate-text --saveNote: This package is currently in alpha release. It is recommended for testing purposes but is not recommended for production use until it reaches a stable state.
npm install @react-native-ml-kit/translate-text --saveLink @react-native-ml-kit/barcode-scanning
mainDepending on your React Native version, follow the appropriate linking procedure:
- React Native > 0.59: The module is automatically linked via the CLI autolink feature during the app build process.
- React Native <= 0.59: Manually link the module using the React Native CLI.
# For React Native <= 0.59 react-native link @react-native-ml-kit/barcode-scanningInstall iOS Pods for image labeling
mainFor iOS development, you must install the native CocoaPods dependencies usingnpx pod-install.npx pod-installPublish the Android library as a Maven dependency
mainBefore publishing a new version of the library to npm, you must publish it as a Maven dependency. This requires having the Android SDK and NDK installed and configured in a
local.propertiesfile within the Android directory.Follow these steps:
- Ensure Android SDK and NDK are installed.
- Configure
local.propertieswith the correct paths to your SDK and NDK. - Delete the existing
mavenfolder. - Execute
./gradlew installArchivesto generate the new artifacts. - Verify that the generated files in the
mavenfolder match the intended version number.
ndk.dir=/Users/{username}/Library/Android/sdk/ndk-bundle sdk.dir=/Users/{username}/Library/Android/sdk./gradlew installArchivesInstall Pods for iOS
mainFor iOS projects, use CocoaPods to add the native
RNMLKitBarcodeScanningdependency to your project.npx pod-installPublish the image-labeling Android library as a Maven dependency
mainBefore publishing a new version to npm, follow these steps to prepare the Android library as a Maven dependency:
- Ensure the Android SDK and NDK are installed on your system.
- Create or update a
local.propertiesfile in the Android folder to point to your SDK and NDK locations. - Delete the existing
mavenfolder. - Execute the Gradle task to install archives.
- Verify that the generated files in the
mavenfolder match the correct version number.
ndk.dir=/Users/{username}/Library/Android/sdk/ndk-bundle sdk.dir=/Users/{username}/Library/Android/sdk./gradlew installArchives