Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
renderCameraModal = () => (
{
this.camera = camera;
}}
style={{ flex: 1 }}
type={RNCamera.Constants.Type.back}
autoFocus={RNCamera.Constants.AutoFocus.on}
flashMode={RNCamera.Constants.FlashMode.off}
permissionDialogTitle={"Permission to use camera"}
permissionDialogMessage={
"We need your permission to use your camera phone"
}
/>
{ this.renderImagesList() }
Cancelar
renderCamera() {
const { scanning } = this.state;
return (
{
if (!scanning) this.handleOnBarCodeRead(data);
}}
/>
);
}
_clickTakePicture = async () => {
if (this.camera) {
const item = await this.camera.takePictureAsync({
mirrorImage: this.state.sideType === RNCamera.Constants.Type.front,
fixOrientation: true,
forceUpOrientation: true,
...this.props.pictureOptions
});
if (Platform.OS === 'ios') {
if (item.uri.startsWith('file://')) {
item.uri = item.uri.substring(7);
}
}
if (this.props.maxSize > 1) {
if (this.state.data.length >= this.props.maxSize) {
Alert.alert('', this.props.maxSizeTakeAlert(this.props.maxSize));
} else {
this.setState({
data: [...this.state.data, item],
});
switchFlash = () => {
let newFlashMode;
const {auto, on, off} = RNCamera.Constants.FlashMode;
if (this.state.camera.flashMode === auto) {
newFlashMode = on;
} else if (this.state.camera.flashMode === on) {
newFlashMode = off;
} else if (this.state.camera.flashMode === off) {
newFlashMode = auto;
}
this.setState({
camera: {
...this.state.camera,
flashMode: newFlashMode,
},
});
};
renderCameraModal = () => (
{
this.camera = camera;
}}
style={{ flex: 1 }}
type={RNCamera.Constants.Type.back}
autoFocus={RNCamera.Constants.AutoFocus.on}
flashMode={RNCamera.Constants.FlashMode.off}
permissionDialogTitle={"Permission to use camera"}
permissionDialogMessage={
"We need your permission to use your camera phone"
}
/>
{ this.renderImagesList() }
Cancelar
super(props);
this.state = {
refreshing: false,
setRefreshing: false,
isModalOpen: false,
orderedStories: null,
selectedStory: null,
tmpImages: null,
images: [],
search: '',
camera: {
//captureTarget: RNCamera.Constants.CaptureTarget.cameraRoll,
type: RNCamera.Constants.Type.back,
orientation: RNCamera.Constants.Orientation.auto,
flashMode: RNCamera.Constants.FlashMode.auto,
},
};
}
render(){
const { renderHeaderView, renderFooterView, torchOn, userFront } = this.props;
return (
this.rnCamera = ref }
captureAudio={ false }
onBarCodeRead={ this.onScanResult }
type={ userFront ? RNCamera.Constants.Type.front : RNCamera.Constants.Type.back }
flashMode={ torchOn ? RNCamera.Constants.FlashMode.torch : RNCamera.Constants.FlashMode.off }
style={ { flex: 1 } }
>
{/*绘制扫描遮罩*/ }
switchCamera() {
if (this.state.type === RNCamera.Constants.Type.back) {
this.setState({
type: RNCamera.Constants.Type.front
});
} else {
this.setState({
type: RNCamera.Constants.Type.back
});
}
}
constructor(props) {
super(props);
this.flashModes = [
RNCamera.Constants.FlashMode.auto,
RNCamera.Constants.FlashMode.off,
RNCamera.Constants.FlashMode.on,
];
this.state = {
data: [],
isPreview: false,
sideType: this.props.sideType,
flashMode: this.props.flashMode,
isRecording: false,
};
}