Skip to content

Camera Preview Not Showing (Blank Screen) on iOS #708

Open
@mmenacer

Description

@mmenacer

Describe the Bug

The camera preview does not display (blank screen) when using <Camera> from react-native-camera-kit on iOS. Barcode scanning does not work, and Xcode logs indicate rendering errors. This issue persists on a physical iOS device.


To Reproduce

Steps to reproduce the behavior:

  1. Install the package:
    yarn add react-native-camera-kit
    cd ios && pod install
    yarn start --reset-cache
  2. Add camera permissions to Info.plist:
    <key>NSCameraUsageDescription</key>
    <string>We need access to your camera for barcode scanning.</string>
  3. Implement the component:
    import { Camera } from 'react-native-camera-kit';
    
    return (
      <Camera
        style={{ flex: 1 }}
        cameraType="back"
        scanBarcode={true}
        onReadCode={(event) => console.log('Scanned:', event.nativeEvent.codeStringValue)}
        showFrame={true}
        laserColor="red"
        frameColor="blue"
      />
    );
  4. Run on a real iOS device.
  5. The screen remains blank, with no camera preview or barcode scanning.
  6. The Torch and the barcode however works fine when I try to scan without saying the barcode. Only a white screen instead of Camera.

Expected Behavior

  • The camera preview should be visible.
  • Barcode scanning should work as expected.
  • The component should mount without errors.

Screenshots

Image


  • Device: iPhone 15 pro
  • OS: iOS 18.3.1

Additional Context

  • Xcode Logs:

    nw_socket_handle_socket_event [C12:1] Socket SO_ERROR [61: Connection refused]
    CGBitmapContextCreate: unsupported parameter combination: NULL colorspace
    react_native_expect failure: value.hasType<std::vector<RawValue>>()
    
  • What I’ve Tried:

    • Verified Info.plist contains correct camera permissions.
    • Ran the app in Release Mode (react-native run-ios --configuration Release).
    • Restarted Metro Bundler (yarn start --reset-cache).
    • Ran on a real iOS device.
    • Added onError={(err) => console.error("Camera Error:", err)} but no additional logs appeared.
  • Works fine on Android.

Could this be an issue with the latest iOS update or package compatibility?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions