expo: [SDK50] [expo-camera/next] Barcode scanner not working on iOS

Minimal reproducible example

https://github.com/stefan-schweiger/expo50-scanner-bug

Summary

Just tried the new expo-camera/next and the barcode scanner appears to not be working on iOS. You can try the repro in Expo Go (but experiencing the same issue in my real app with a dev client) and just scan some random QR code like the one below on Android and you will get log messages with the data. On iOS though just nothing happens.

export default function App() {
  const handleCodeScanned = (data) => {
    console.log(data);
  }

  const [permission, requestPermission] = useCameraPermissions();

  useEffect(() => {
    requestPermission();
  });

  if (!permission?.granted) {
    return null;
  }

  return (
    <View style={styles.container}>
      <CameraView style={styles.camera} barcodeScannerSettings={{ barCodeTypes: ['qr'] }} onBarcodeScanned={handleCodeScanned} />
    </View>
  );
}
image

Environment

  expo-env-info 1.2.0 environment info:
    System:
      OS: macOS 14.2.1
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 21.5.0 - /opt/homebrew/bin/node
      Yarn: 1.22.19 - /usr/local/bin/yarn
      npm: 10.2.4 - /opt/homebrew/bin/npm
      Watchman: 2023.12.04.00 - /opt/homebrew/bin/watchman
    Managers:
      CocoaPods: 1.14.3 - /opt/homebrew/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 23.2, iOS 17.2, macOS 14.2, tvOS 17.2, visionOS 1.0, watchOS 10.2
    IDEs:
      Xcode: 15.2/15C500b - /usr/bin/xcodebuild
    npmPackages:
      expo: ~50.0.3 => 50.0.3 
      react: 18.2.0 => 18.2.0 
      react-native: 0.73.2 => 0.73.2 
    Expo Workflow: managed

About this issue

  • Original URL
  • State: closed
  • Created 5 months ago
  • Reactions: 6
  • Comments: 17 (6 by maintainers)

Most upvoted comments

@xcboi2k you are using the legacy camera with some of the props for the new camera. You need to use it like this

<Camera
  barCodeScannerSettings={{
    barCodeTypes: [BarCodeScanner.Constants.BarCodeType.qr],
  }}
/>

carbon im at sdk49, it works in expo go but not in development build, i also tried updating to sdk50 but same outcome

Hi @stefan-schweiger - fix has been published in 14.0.3.