react-native-camera-kit: Can't turn off flash on android

Followed the example and set flash to off, but it’s still set to auto

        ref={(cam) => {
                            this.camera = cam;
                            }
                }
        style={{flex: 1, backgroundColor:'white'}}
        cameraOptions={{
                    flashMode: 'off',             // on/off/auto(default)
                    focusMode: 'on',               // off/on(default)
                    zoomMode: 'on',                // off/on(default)
                    ratioOverlay:'1:1',            // optional, ratio overlay on the camera and crop the image seamlessly 
                    ratioOverlayColor: '#00000077' // optional
                    }}
/>```

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 16 (6 by maintainers)

Most upvoted comments

@gran33 so you can do something like that:

<CameraKitCamera
      ref={(cam) => {
        window.camera = cam;
      }}
      style={{
        width: Dimensions.get('window').width,
        height: Dimensions.get('window').width
      }}
      cameraOptions={{
        flashMode: 'off',             // on/off/auto(default)
        focusMode: 'on',               // off/on(default)
        zoomMode: 'on',                // off/on(default)
        ratioOverlay: '1:1',            // optional, ratio overlay on the camera and crop the image seamlessly
        ratioOverlayColor: '#00000077' // optional
      }}
    />

if you on your iphone try to make a photo on very black background (put your phone on a desk for example), it uses the flash.

I think a fix could be the following:

In CKCamera.m you are using

            [CKCamera setFlashMode:AVCaptureFlashModeAuto forDevice:self.videoDeviceInput.device];

instead you should be using

            [CKCamera setFlashMode:self.flashMode forDevice:self.videoDeviceInput.device];

@gran33 sorry wrong issue.