a7medev / react-native-ml-kit

React Native On-Device Machine Learning w/ Google ML Kit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing Platform import on most modules

Scubbero opened this issue · comments

What happened?

while testing barcode scanning i've noticed that when the NativeModule is not present we get this error:

ReferenceError: Platform is not defined

Checking the code i've noticed that on index.js we have the following code:

import { NativeModules } from 'react-native';

const LINKING_ERROR =
  `The package '@react-native-ml-kit/barcode-scanning' doesn't seem to be linked. Make sure: \n\n` +
  Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
  '- You rebuilt the app after installing the package\n' +
  '- You are not using Expo managed workflow\n';

...

Here we can see Platform is not being imported.

Version

@react-native-ml-kit/barcode-scanning: version@react-native-ml-kit/face-detection: version@react-native-ml-kit/identify-languages: version@react-native-ml-kit/image-labeling: version@react-native-ml-kit/text-recognition: version@react-native-ml-kit/translate-text: version

Which ML Kit packages do you use?

  • @react-native-ml-kit/barcode-scanning
  • @react-native-ml-kit/face-detection
  • @react-native-ml-kit/identify-languages
  • @react-native-ml-kit/image-labeling
  • @react-native-ml-kit/text-recognition
  • @react-native-ml-kit/translate-text

What platforms are you seeing this issue on?

  • Android
  • iOS

System Information

System:
    OS: macOS 13.4.1
    CPU: (8) arm64 Apple M1 Pro
    Memory: 161.33 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 16.15.1 - ~/.nodenv/versions/16.15.1/bin/node
    Yarn: 1.22.19 - ~/Dev/mobile-app/node_modules/.bin/yarn
    npm: 8.11.0 - ~/.nodenv/versions/16.15.1/bin/npm
    Watchman: 2023.04.10.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.12.0 - /Users/claudiovalenzuela/.rbenv/shims/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
    Android SDK: Not Found
  IDEs:
    Android Studio: 2021.1 AI-211.7628.21.2111.8193401
    Xcode: 14.2/14C18 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.11 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2 
    react-native: 0.67.5 => 0.67.5 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps to Reproduce

attempt to import the library on a test enviromnment

Thanks a lot @Scubbero for reporting this! I've fixed them and will release new versions very soon 🙏🏼