React Native ML Kit

repository·main·Indexed 20 days ago

https://github.com/a7medev/react-native-ml-kit

A 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).

Tokens
10K
Snippets
44
Records
53
Agent score
69%

What's inside react-native-ml-kit

  1. Overview of React Native ML Kit

    main
    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.
  2. Install @react-native-ml-kit/text-recognition

    main

    Install the text recognition module using npm:

    npm install @react-native-ml-kit/text-recognition --save

    Linking

    • 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-install
  3. Configure native linking for face-detection

    main

    Depending 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-detection
  4. Configure native linking and Pods

    main

    Linking

    • 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-install

    npx pod-install
  5. Install @react-native-ml-kit/translate-text

    main

    Install the package using npm to add it to your React Native project:

    npm install @react-native-ml-kit/translate-text --save

    Note: 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 --save
  6. Link @react-native-ml-kit/barcode-scanning

    main

    Depending 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-scanning
  7. Publish the Android library as a Maven dependency

    main

    Before 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.properties file within the Android directory.

    Follow these steps:

    1. Ensure Android SDK and NDK are installed.
    2. Configure local.properties with the correct paths to your SDK and NDK.
    3. Delete the existing maven folder.
    4. Execute ./gradlew installArchives to generate the new artifacts.
    5. Verify that the generated files in the maven folder match the intended version number.
    ndk.dir=/Users/{username}/Library/Android/sdk/ndk-bundle
    sdk.dir=/Users/{username}/Library/Android/sdk
    ./gradlew installArchives
  8. Publish the image-labeling Android library as a Maven dependency

    main

    Before publishing a new version to npm, follow these steps to prepare the Android library as a Maven dependency:

    1. Ensure the Android SDK and NDK are installed on your system.
    2. Create or update a local.properties file in the Android folder to point to your SDK and NDK locations.
    3. Delete the existing maven folder.
    4. Execute the Gradle task to install archives.
    5. Verify that the generated files in the maven folder match the correct version number.
    ndk.dir=/Users/{username}/Library/Android/sdk/ndk-bundle
    sdk.dir=/Users/{username}/Library/Android/sdk
    ./gradlew installArchives