react-native-vision-camera: š [Code Scanner][IOS] The codeType "qr" is not supported by the Code Scanner
Whatās happening?
Iāve updated to react-native-vision-camera@v3.4.0
but camera throws error
[code-scanner/code-type-not-supported: The codeType "qr" is not supported by the Code Scanner!]
I get the same error with other codeTypes
I use react-native v0.72.5
Reproduceable Code
const deviceBack = useCameraDevice('back');
const codeScanner: CodeScanner = {
codeTypes: ['qr'],
onCodeScanned: codes => {
const [code] = codes;
onBarcodeDetected?.(code.value);
},
};
<Camera
ref={camera}
zoom={1}
device={deviceBack}
isActive={true}
codeScanner={codeScanner}
onError={e => console.log(e)}
/>
Relevant log output
No useful info in Xcode logs
Camera Device
basic IPhone 14 Pro JSON, takes too much space. I might create a json file link if needed
Device
iPhone 14 Pro (iOS 17.0.3)
VisionCamera Version
3.4.0
Can you reproduce this issue in the VisionCamera Example app?
I didnāt try (ā ļø your issue might get ignored & closed if you donāt try this)
Additional information
- I am using Expo
- I have enabled Frame Processors (react-native-worklets-core)
- I have read the Troubleshooting Guide
- I agree to follow this projectās Code of Conduct
- I searched for similar issues in this repository and found none.
About this issue
- Original URL
- State: closed
- Created 8 months ago
- Reactions: 6
- Comments: 22 (7 by maintainers)
Hi - few things:
Anyways, I did the work and created a PR, will merge this to main and release soon.
I just released VisionCamera 3.4.1 which fixes the issue with the QR Code Scanner now! šŖ
I donāt know much about native iOS dev, but it appears the problem is that in the
configureOutputs()
function of CameraSession+Configuration.swift, thecaptureSession.addOutput(codeScannerOutput)
line needs to come before checking the types, as per this SO post.It works for me when I put the line above.
@JeyongOh-MAASASIA I barely know any Swift and much less the iOS SDKs, so I wouldnāt recommend this for a production app. Also, fortunately, this repo seems to be quite actively maintained, so itāll probably get properly fixed soon. But if you want a hotfix ASAP, this will work:
It essentially swaps the ā1. Configureā and ā2. Addā blocks.
@mrousavy When are you planning to make a release where this is included?
Superb work in this library, btw. And kudos for adding code scanning support without plugins š
@iliapnmrv this is what you saw when you clicked on āCreate Issueā:
Iām having the same issue. When āqrā or āean-13ā is specified in the codeTypes array, the camera wonāt start.
Hereās some logs from Xcode:

Edit: Downgrading to 3.3.1 fixed it.
@mrousavy this may be useful for you