Skip to content

v2.0.1

Latest

Choose a tag to compare

@pedrol2b pedrol2b released this 20 Aug 21:32
8202153

Patch release fixing the iOS build failure introduced by the selective ML Kit
install in 2.0.0. Promotes 2.0.1-rc.0 to latest after the reporter of #22
confirmed it resolves the failure on their EAS build.

Install

yarn add react-native-vision-camera-mlkit@2.0.1

Then re-run pod install, or npx expo prebuild --clean on the Expo prebuild
workflow.

Fixed

  • iOS: text recognition failed to build when any language model was disabled
    via selective install.
    Each case of the switch over
    DomainTextRecognitionLanguage was wrapped in its own
    #if MLKIT_TEXT_RECOGNITION* flag, so disabling a language compiled that
    case out while the enum still declared all five, leaving the switch
    non-exhaustive:

    TextRecognitionServiceFactory.swift:31:7: error: switch must be exhaustive
    

    Only all-five-enabled built, or all-five-disabled (where the whole file drops
    out) — meaning every partial selection, which is the entire point of the
    feature, was broken. Anyone following the README's advice to disable unused
    language models to reduce binary size hit this.

    The #if guards now live inside each case body, keeping the switch
    exhaustive under every flag combination. Requesting a language whose model
    was excluded from the build now throws a descriptive error naming the
    configuration key to enable, matching the exception Android already raises,
    rather than crashing. (#22, #23)

Android was never affected — it uses source-set swapping plus reflection, so
its when stayed exhaustive.

Upgrading

No code changes required. If you worked around this by enabling all five
language models, you can now disable the ones you don't need and recover the
binary size:

[
  "react-native-vision-camera-mlkit",
  {
    "textRecognition": true,
    "textRecognitionChinese": false,
    "textRecognitionDevanagari": false,
    "textRecognitionJapanese": false,
    "textRecognitionKorean": false
  }
]

Verified

Real pod install + xcodebuild per configuration, with the emitted
SWIFT_ACTIVE_COMPILATION_CONDITIONS read back from the generated xcconfig:

Config Result
latin only, on 2.0.0 fails — switch must be exhaustive
latin only builds
chinese only, latin disabled builds
all five builds
latin only, full example app builds and links

Full changelog: v2.0.0...v2.0.1