React-Native-Camera Error when take photo with modified flashMode attribute -
i getting following error when trying take photo flashmode attribute modified:
{ nslocalizeddescription: 'error domain=avfoundationerrordomain code=-11800 "the operation not completed" userinfo={nsunderlyingerror=0x170440210 {error domain=nsosstatuserrordomain code=-16800 "(null)"}, nslocalizedfailurereason=an unknown error occurred (-16800), nslocalizeddescription=the operation not completed}' } } 2017-09-12 00:08:29.907053-0300 gimenesapp[1936:765074] { [error: error domain=avfoundationerrordomain code=-11800 "the operation not completed" userinfo={nsunderlyingerror=0x170440210 {error domain=nsosstatuserrordomain code=-16800 "(null)"}, nslocalizedfailurereason=an unknown error occurred (-16800), nslocalizeddescription=the operation not completed}]
here piece of code using:
<camera capturetarget={camera.constants.capturetarget.disk} ref={(cam) => { this.camera = cam; }} flashmode={this.state.flashmode}> <button onpress={this.takepicture.bind(this)} transparent <icon name="ios-radio-button-off" /> </button> </camera>
so, solved error removing 2 calls setstate
here take photo method:
takepicture() { const options = {}; this.camera.capture({metadata: options}) .then((data) => { this.setstate({ photo_path: data.path, is_not_photo_take: false }); }) .catch(err => { console.error(err) }); };
before, setting state twice in takepicture method. moved outside setstate , error gone.
i not know why, now, working.
if have explanation error, please, share us.
Comments
Post a Comment