Remove extra imperative references

This commit is contained in:
aarongrider 2021-01-05 13:29:25 -08:00
parent e0dac782b0
commit 7dafa09114
1 changed files with 1 additions and 18 deletions

View File

@ -1,5 +1,5 @@
import * as _ from 'lodash';
import React, { useEffect } from 'react';
import React from 'react';
import { requireNativeComponent, NativeModules, processColor } from 'react-native';
const { CKCameraManager } = NativeModules;
@ -8,14 +8,6 @@ const NativeCamera = requireNativeComponent('CKCamera');
function Camera(props, ref) {
const nativeRef = React.useRef();
useEffect(() => {
CKCameraManager.changeCamera();
}, [props.type]);
useEffect(() => {
CKCameraManager.setFlashMode(props.flashMode);
}, [props.flashMode]);
React.useImperativeHandle(ref, () => ({
capture: async () => {
return await CKCameraManager.capture({});
@ -26,15 +18,6 @@ function Camera(props, ref) {
checkDeviceCameraAuthorizationStatus: async () => {
return await CKCameraManager.checkDeviceCameraAuthorizationStatus();
},
changeCamera: async () => {
return await CKCameraManager.changeCamera();
},
setFlashMode: async (flashMode = 'auto') => {
return await CKCameraManager.setFlashMode(flashMode);
},
setTorchMode: async (torchMode = '') => {
return await CKCameraManager.setTorchMode(torchMode);
},
}));
const transformedProps = _.cloneDeep(props);