Skip to content

Commit

Permalink
fix: Fix mapping of itf and add new itf-14 type in iOS (#3252)
Browse files Browse the repository at this point in the history
* fix links

* map itf to interleaved2of5 and add new itf-14 type for iOS
  • Loading branch information
Regina-v authored Oct 29, 2024
1 parent 51d0a8a commit db99c08
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
yarn bootstrap
```

Read the READMEs in [`android/`](android/README.md) and [`ios/`](ios/README.md) for a quick overview of the native development workflow.
Read the READMEs in [`android/`](package/android/README.md) and [`ios/`](package/ios/README.md) for a quick overview of the native development workflow.

> You can also open VisionCamera in [a quick online editor (github1s)](https://github1s.com/mrousavy/react-native-vision-camera)
Expand Down
8 changes: 7 additions & 1 deletion docs/docs/guides/CODE_SCANNING.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ A Code Scanner is a separate Camera output (just like photo or video) that can d
- **Data Matrix**: Square Data Matrix codes
- **Barcode (EAN)**: EAN-13 or EAN-8 Barcodes
- **Barcode (Code)**: Code-128, Code-39 or Code-93 Barcodes
- **Barcode (other)**: Codabar, ITF-14, UPC-E or PDF-417 Barcodes
- **Barcode (other)**: Codabar, Interleaved2of5 (ITF), ITF-14, UPC-E or PDF-417 Barcodes

## Setup

Expand Down Expand Up @@ -142,4 +142,10 @@ const codeScanner = useCodeScanner({

You will need to keep this in mind and do the conversion from EAN-13 to UPC-A yourself. This can be done by removing the front `0` digit from the code to get a UPC-A code.

## Interleaved2of5 (ITF) and ITF-14

Interleaved2of5 (ITF) barcodes are supported by both, Android and iOS, where Android's SDK supports barcodes in ITF format with a minimum length of 6 characters.

ITF-14 is a sub type of interleaved2of5 which always encodes 14 characters. The ITF-14 type is only supported by iOS. If you want to have the restriction to 14 characters in Android as well, you have to handle this in your own code.

#### 🚀 Next section: [Frame Processors](frame-processors)
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ extension AVMetadataObject.ObjectType {
self = .ean8
return
case "itf":
self = .interleaved2of5
return
case "itf-14":
self = .itf14
return
case "upc-e":
Expand Down Expand Up @@ -78,8 +81,10 @@ extension AVMetadataObject.ObjectType {
return "ean-13"
case .ean8:
return "ean-8"
case .itf14:
case .interleaved2of5:
return "itf"
case .itf14:
return "itf-14"
case .upce:
return "upce"
case .qr:
Expand Down
1 change: 1 addition & 0 deletions package/src/types/CodeScanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export type CodeType =
| 'ean-13'
| 'ean-8'
| 'itf'
| 'itf-14'
| 'upc-e'
| 'upc-a'
| 'qr'
Expand Down

0 comments on commit db99c08

Please sign in to comment.