diff --git a/README.md b/README.md index 4f0994e..b8f107b 100644 --- a/README.md +++ b/README.md @@ -237,11 +237,15 @@ Supported options: - `metadata` This is metadata to be added to the captured image. - `location` This is the object returned from `navigator.geolocation.getCurrentPosition()` (React Native's geolocation polyfill). It will add GPS metadata to the image. - `rotation` This will rotate the image by the number of degrees specified. - + #### `stopCapture()` Ends the current capture session for video captures. Only applies when the current `captureMode` is `video`. +### `checkDeviceAuthorizationStatus(callback(err, isAuthorized))` + +Exposes the native API for checking if the device has authorized access to the camera. Can be used to call before loading the Camera component to ensure proper UX. + ## Subviews This component supports subviews, so if you wish to use the camera view as a background or if you want to layout buttons/images/etc. inside the camera then you can do that. diff --git a/index.ios.js b/index.ios.js index 28cc51d..8eabcb9 100644 --- a/index.ios.js +++ b/index.ios.js @@ -11,7 +11,7 @@ var constants = { CaptureTarget: NativeModules.CameraManager.CaptureTarget, Orientation: NativeModules.CameraManager.Orientation, FlashMode: NativeModules.CameraManager.FlashMode, - TorchMode: NativeModules.CameraManager.TorchMode, + TorchMode: NativeModules.CameraManager.TorchMode }; var Camera = React.createClass({ @@ -84,7 +84,7 @@ var Camera = React.createClass({ componentWillUnmount() { this.cameraBarCodeReadListener.remove(); - + if (this.state.isRecording) { this.stopCapture(); } @@ -120,7 +120,7 @@ var Camera = React.createClass({ if (typeof aspect === 'string') { aspect = constants.Aspect[aspect]; } - + if (typeof flashMode === 'string') { flashMode = constants.FlashMode[flashMode]; } @@ -128,7 +128,7 @@ var Camera = React.createClass({ if (typeof orientation === 'string') { orientation = constants.Orientation[orientation]; } - + if (typeof torchMode === 'string') { torchMode = constants.TorchMode[torchMode]; } @@ -169,7 +169,7 @@ var Camera = React.createClass({ if (typeof options.mode === 'string') { options.mode = constants.CaptureMode[options.mode]; } - + if (options.mode === constants.CaptureMode.video) { options.totalSeconds = (options.totalSeconds > -1 ? options.totalSeconds : -1); options.preferredTimeScale = options.preferredTimeScale || 30; @@ -199,4 +199,6 @@ var styles = StyleSheet.create({ }); Camera.constants = constants; +Camera.checkDeviceAuthorizationStatus = NativeModules.CameraManager.checkDeviceAuthorizationStatus + module.exports = Camera;