Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
onCameraReady={this.collectPictureSizes}
type={this.state.type}
flashMode={this.state.flash}
autoFocus={this.state.autoFocus}
zoom={this.state.zoom}
whiteBalance={this.state.whiteBalance}
ratio={this.state.ratio}
pictureSize={this.state.pictureSize}
onMountError={this.handleMountError}
onFacesDetected={this.state.faceDetecting ? this.onFacesDetected : undefined}
faceDetectorSettings={{
tracking: true,
}}
barCodeScannerSettings={{
barCodeTypes: [
BarCodeScanner.Constants.BarCodeType.qr,
BarCodeScanner.Constants.BarCodeType.pdf417,
],
}}
onBarCodeScanned={this.state.barcodeScanning ? this.onBarCodeScanned : undefined}>
{this.renderTopBar()}
{this.renderBottomBar()}
{this.state.faceDetecting && this.renderFaces()}
{this.state.faceDetecting && this.renderLandmarks()}
{this.state.showMoreOptions && this.renderMoreOptions()}
);
case PermissionState.Denied:
return ;
case PermissionState.Granted:
return (
);
default:
const _: never = this.state.cameraPermission;
return _;
}
}
ref={ref => (this.camera = ref)}
style={styles.camera}
onCameraReady={this.collectPictureSizes}
type={this.state.type}
flashMode={this.state.flash}
autoFocus={this.state.autoFocus}
zoom={this.state.zoom}
whiteBalance={this.state.whiteBalance}
ratio={this.state.ratio}
pictureSize={this.state.pictureSize}
onMountError={this.handleMountError}
onFacesDetected={this.state.faceDetecting ? this.onFacesDetected : undefined}
barCodeScannerSettings={{
barCodeTypes: [
BarCodeScanner.Constants.BarCodeType.qr,
BarCodeScanner.Constants.BarCodeType.pdf417,
],
}}
onBarCodeScanned={this.state.barcodeScanning ? this.onBarCodeScanned : undefined}>
{this.renderTopBar()}
{this.renderBottomBar()}
{this.state.faceDetecting && this.renderFaces()}
{this.state.faceDetecting && this.renderLandmarks()}
{this.state.showMoreOptions && this.renderMoreOptions()}
);
Requesting camera permission to scan a league code.
);
} else if (this.state.hasCameraPermission === false) {
content = (
eLadder needs camera permission to scan a league code.
);
} else {
content = (
);
}
return {content};
}
}
toggleType = () =>
this.setState({
type:
this.state.type === BarCodeScanner.Constants.Type.back
? BarCodeScanner.Constants.Type.front
: BarCodeScanner.Constants.Type.back,
})
width: number;
height: number;
};
};
}
export default class BarcodeScannerExample extends React.Component<{}, State> {
static navigationOptions = {
title: '',
};
canChangeOrientation = false;
readonly state: State = {
isPermissionsGranted: false,
type: BarCodeScanner.Constants.Type.back,
alerting: false,
haveDimensions: false,
};
componentDidFocus = async () => {
const { status } = await Permissions.askAsync(Permissions.CAMERA);
this.setState({ isPermissionsGranted: status === 'granted' });
}
toggleAlertingAboutResult = () => {
this.setState({ alerting: !this.state.alerting });
}
toggleScreenOrientationState = () => {
if (this.canChangeOrientation) {
ScreenOrientation.lockAsync(ScreenOrientation.OrientationLock.PORTRAIT_UP);
type={this.state.type}
flashMode={this.state.flash}
autoFocus={this.state.autoFocus}
zoom={this.state.zoom}
whiteBalance={this.state.whiteBalance}
ratio={this.state.ratio}
pictureSize={this.state.pictureSize}
onMountError={this.handleMountError}
onFacesDetected={this.state.faceDetecting ? this.onFacesDetected : undefined}
faceDetectorSettings={{
tracking: true,
}}
barCodeScannerSettings={{
barCodeTypes: [
BarCodeScanner.Constants.BarCodeType.qr,
BarCodeScanner.Constants.BarCodeType.pdf417,
],
}}
onBarCodeScanned={this.state.barcodeScanning ? this.onBarCodeScanned : undefined}>
{this.renderTopBar()}
{this.renderBottomBar()}
{this.state.faceDetecting && this.renderFaces()}
{this.state.faceDetecting && this.renderLandmarks()}
{this.state.showMoreOptions && this.renderMoreOptions()}
);
fill="green"
/>
);
}
}
return (
r={2}
strokeWidth={0.1}
stroke="gray"
fill="green"
/>
);
}
}
return (
} else if (hasCameraPermission === false) {
return (
);
} else {
return (
);
}
}
}