diff --git a/docs/docs/guides/CODE_SCANNING.mdx b/docs/docs/guides/CODE_SCANNING.mdx index ff83cd461a..7dc1a9a0cb 100644 --- a/docs/docs/guides/CODE_SCANNING.mdx +++ b/docs/docs/guides/CODE_SCANNING.mdx @@ -148,4 +148,23 @@ Interleaved2of5 (ITF) barcodes are supported by both, Android and iOS, where And 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. +## Supported Code Types + +| Code Type | iOS | Android | +|----------------------|--------------------|--------------------| +| qr | :white_check_mark: | :white_check_mark: | +| aztec | :white_check_mark: | :white_check_mark: | +| data-matrix | :white_check_mark: | :white_check_mark: | +| ean-13 | :white_check_mark: | :white_check_mark: | +| ean-8 | :white_check_mark: | :white_check_mark: | +| code-128 | :white_check_mark: | :white_check_mark: | +| code-39 | :white_check_mark: | :white_check_mark: | +| code-93 | :white_check_mark: | :white_check_mark: | +| codabar | 15.4+ | :white_check_mark: | +| itf | :white_check_mark: | :white_check_mark: | +| itf-14 | :white_check_mark: | :white_check_mark: | +| upc-e | :white_check_mark: | :white_check_mark: | +| upc-a | :white_check_mark: | :white_check_mark: | +| pdf-417 | :white_check_mark: | :white_check_mark: | + #### 🚀 Next section: [Frame Processors](frame-processors) diff --git a/example/src/CodeScannerPage.tsx b/example/src/CodeScannerPage.tsx index 650315ecc3..70f7821541 100644 --- a/example/src/CodeScannerPage.tsx +++ b/example/src/CodeScannerPage.tsx @@ -62,7 +62,7 @@ export function CodeScannerPage({ navigation }: Props): React.ReactElement { // 5. Initialize the Code Scanner to scan QR codes and Barcodes const codeScanner = useCodeScanner({ - codeTypes: ['qr', 'ean-13'], + codeTypes: ['qr', 'ean-13', 'codabar'], onCodeScanned: onCodeScanned, }) diff --git a/package/ios/Core/Parsers/AVMetadataObject.ObjectType+descriptor.swift b/package/ios/Core/Parsers/AVMetadataObject.ObjectType+descriptor.swift index d51e0d7f4d..b0ad08eb51 100644 --- a/package/ios/Core/Parsers/AVMetadataObject.ObjectType+descriptor.swift +++ b/package/ios/Core/Parsers/AVMetadataObject.ObjectType+descriptor.swift @@ -10,7 +10,7 @@ import AVFoundation import Foundation extension AVMetadataObject.ObjectType { - init(withString string: String) throws { + init?(withString string: String) throws { switch string { case "code-128": self = .code128 @@ -25,7 +25,7 @@ extension AVMetadataObject.ObjectType { if #available(iOS 15.4, *) { self = .codabar } else { - throw CameraError.codeScanner(.codeTypeNotSupported(codeType: string)) + return nil } return case "ean-13": diff --git a/package/ios/Core/Types/CodeScannerOptions.swift b/package/ios/Core/Types/CodeScannerOptions.swift index 92993d05fa..ec7e58b2a3 100644 --- a/package/ios/Core/Types/CodeScannerOptions.swift +++ b/package/ios/Core/Types/CodeScannerOptions.swift @@ -16,7 +16,7 @@ struct CodeScannerOptions: Equatable { init(fromJsValue dictionary: NSDictionary) throws { if let codeTypes = dictionary["codeTypes"] as? [String] { - self.codeTypes = try codeTypes.map { value in + self.codeTypes = try codeTypes.compactMap { value in return try AVMetadataObject.ObjectType(withString: value) } } else {