diff options
Diffstat (limited to 'src/utils/camera.ts')
-rw-r--r-- | src/utils/camera.ts | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/utils/camera.ts b/src/utils/camera.ts index ec2615de..6edc2b4f 100644 --- a/src/utils/camera.ts +++ b/src/utils/camera.ts @@ -24,15 +24,20 @@ export const takePicture = ( callback: (pic: TakePictureResponse) => void, ) => { if (cameraRef !== null) { + cameraRef.current?.pausePreview(); const options: TakePictureOptions = { forceUpOrientation: true, orientation: 'portrait', writeExif: false, - pauseAfterCapture: true, }; - cameraRef.current?.takePictureAsync(options).then((pic) => { - callback(pic); - }); + cameraRef.current + ?.takePictureAsync(options) + .then((pic) => { + callback(pic); + }) + .catch((error) => { + console.log(error); + }); } }; @@ -46,9 +51,14 @@ export const takeVideo = ( maxDuration: MAX_VIDEO_RECORDING_DURATION, quality: '1080p', }; - cameraRef.current?.recordAsync(options).then((vid) => { - callback(vid); - }); + cameraRef.current + ?.recordAsync(options) + .then((vid) => { + callback(vid); + }) + .catch((error) => { + console.log(error); + }); } }; |