react-native-vision-camera icon indicating copy to clipboard operation
react-native-vision-camera copied to clipboard

fix: Fix mapping of itf and add new itf-14 type in iOS

Open Regina-v opened this issue 1 year ago • 1 comments

What

I can't scan interleaved2of5 (ITF) barcodes in iOS.

Currently the CodeType itf is mapped:

ITF-14 is a variant of ITF with a fixed length of 14 characters. The problem is that the iOS AVMetadataObject.ObjectType.interleaved2of5 type is not mapped at all and therefore interleaved2of5 barcodes with a different length than 14 characters cannot be scanned in iOS.

Changes

Added and changed the mapping for iOS:

  • itf -> interleaved2of5
  • new itf-14 -> itf14 (iOS only)

Updated documentation about code types.

If you add now itf-14 unconditionally (i.e. don't exclude it for android) to the codeTypes array of the CodeScanner, in android it will (expectedly) throw the error "The given value for codeType could not be parsed! (Received: itf-14)".

Tested on

  • iPhone 12 mini, iOS 18.1
  • Google Pixel 7, Android 15

Related issues

  • fixes #2089
  • fixes #2064

Regina-v avatar Oct 19 '24 18:10 Regina-v

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-native-vision-camera ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 19, 2024 6:18pm

vercel[bot] avatar Oct 19 '24 18:10 vercel[bot]

Awesome!! Nice high quality PR, thanks for the fix and thanks for the explanation. LGTM! ❤️

mrousavy avatar Oct 29 '24 08:10 mrousavy