Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_record() {
this.camera.capture({
mode: Camera.constants.CaptureMode.video,
audio: true
}).then((data) => {
if (this.props.setID) {
this.props.saveVideo(this.props.setID, data.path, this.props.videoType);
}
// TODO: share options can be here, but for now just finish
}).catch((err) => {
console.tron.log("ERROR " + err);
this.props.saveVideoError(this.props.setID, err);
Alert.alert('There was an issue saving your video. Please try again');
});
}
toggleFlash() {
this.setState({
flashlightEnabled: !this.state.flashlightEnabled,
torchMode: this.state.torchMode == Camera.constants.TorchMode.off ?
Camera.constants.TorchMode.on : Camera.constants.TorchMode.off
});
}
render() {
return (
);
}
_renderCamera() {
if (this.props.isModalShowing) {
return (
toggleFlash() {
this.setState({
flashlightEnabled: !this.state.flashlightEnabled,
torchMode: this.state.torchMode == Camera.constants.TorchMode.off ?
Camera.constants.TorchMode.on : Camera.constants.TorchMode.off
});
}
constructor(props) {
super(props);
this.camera = null;
this.state = {
aspect: Camera.constants.Aspect.fill,
captureTarget: Camera.constants.CaptureTarget.cameraRoll,
type: Camera.constants.Type.front,
orientation: Camera.constants.Orientation.auto,
flashMode: Camera.constants.FlashMode.auto,
loading: true,
permissionDenied: false,
};
}
render() {
return (
);
}
}
);
} else {
return (
render() {
return (
constructor(props) {
super(props);
this.camera = null;
this.state = {
camera: {
aspect: Camera.constants.Aspect.fill,
captureTarget: Camera.constants.CaptureTarget.cameraRoll,
type: Camera.constants.Type.back,
orientation: Camera.constants.Orientation.auto,
flashMode: Camera.constants.FlashMode.auto,
},
isRecording: false
};
}