How to use the expo-barcode-scanner.BarCodeScanner.Constants function in expo-barcode-scanner

To help you get started, we’ve selected a few expo-barcode-scanner examples, based on popular ways it is used in public projects.

github expo / expo / apps / native-component-list / src / screens / Camera / CameraScreen.tsx View on Github external
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()}
      </Camera>
      {this.state.faceDetecting && this.renderFaces()}
      {this.state.faceDetecting && this.renderLandmarks()}
      {this.state.showMoreOptions && this.renderMoreOptions()}
    </View>
  );
github janaagaard75 / expo-and-typescript / src / BarCodeScannerScreen.tsx View on Github external
case PermissionState.Denied:
        return <Text>No access to the camera.</Text>;

      case PermissionState.Granted:
        return (
          <View style={{ flex: 1 }}>
            <Text
              style={{
                margin: 10
              }}
            >
              this.state.scannerStatus
            </Text>
            <View style={{ flex: 1 }}>
              <BarCodeScanner
                barCodeTypes={[BarCodeScanner.Constants.BarCodeType.qr]}
                onBarCodeScanned={this.handleBarCodeScanned}
                style={StyleSheet.absoluteFill}
              />
            </View>
          </View>
        );

      default:
        const _: never = this.state.cameraPermission;
        return _;
    }
  }
github expo / expo / home / screens / CameraScreen.js View on Github external
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()}
      </Camera>
      {this.state.faceDetecting && this.renderFaces()}
      {this.state.faceDetecting && this.renderLandmarks()}
      {this.state.showMoreOptions && this.renderMoreOptions()}
    </View>
  );
github bastiRe / eLadder / app / components / base / LeagueScanner.js View on Github external
Requesting camera permission to scan a league code.
        </CenteredText>
      );
    } else if (this.state.hasCameraPermission === false) {
      content = (
        <CenteredText>
          eLadder needs camera permission to scan a league code.
        </CenteredText>
      );
    } else {
      content = (
        <React.Fragment>
          <BarCodeScanner
            style={StyleSheet.absoluteFillObject}
            onBarCodeScanned={this._handleBarCodeRead}
            barCodeTypes={[BarCodeScanner.Constants.BarCodeType.qr]}
          />
          <OverlayContainer>
            <Overlay />
          </OverlayContainer>
        </React.Fragment>
      );
    }

    return <Container>{content}</Container>;
  }
}
github expo / expo / apps / native-component-list / src / screens / BarCodeScannerScreen.tsx View on Github external
toggleType = () =>
    this.setState({
      type:
        this.state.type === BarCodeScanner.Constants.Type.back
          ? BarCodeScanner.Constants.Type.front
          : BarCodeScanner.Constants.Type.back,
    })
github expo / expo / apps / native-component-list / src / screens / BarCodeScannerScreen.tsx View on Github external
width: number;
      height: number;
    };
  };
}

export default class BarcodeScannerExample extends React.Component<{}, State> {
  static navigationOptions = {
    title: '<BarCodeScanner />',
  };

  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);
github expo / expo / apps / native-component-list / src / screens / Camera / CameraScreen.tsx View on Github external
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()}
      </Camera>
      {this.state.faceDetecting && this.renderFaces()}
      {this.state.faceDetecting && this.renderLandmarks()}
      {this.state.showMoreOptions && this.renderMoreOptions()}
    </View>
  );
github expo / expo / apps / native-component-list / src / screens / BarCodeScannerScreen.tsx View on Github external
fill="green"
          />
        );
      }
    }

    return (
      <View style={styles.container}>
        <BarCodeScanner
          onLayout={this.setCanvasDimensions}
          onBarCodeScanned={this.handleBarCodeScanned}
          barCodeTypes={[
            BarCodeScanner.Constants.BarCodeType.qr,
            BarCodeScanner.Constants.BarCodeType.pdf417,
            BarCodeScanner.Constants.BarCodeType.code128,
            BarCodeScanner.Constants.BarCodeType.code39,
          ]}
          type={this.state.type}
          style={styles.preview}
        />

        {this.state.haveDimensions && (
          <Svg.Svg height={this.state.canvasHeight} width={this.state.canvasWidth} style={styles.svg}>
            <Svg.Circle
              cx={this.state.canvasWidth! / 2}
              cy={this.state.canvasHeight! / 2}
              r={2}
              strokeWidth={2.5}
              stroke="#e74c3c"
              fill="#f1c40f"
            />
            {this.state.boundingBox && (
github expo / expo / apps / native-component-list / src / screens / BarCodeScannerScreen.tsx View on Github external
r={2}
            strokeWidth={0.1}
            stroke="gray"
            fill="green"
          />
        );
      }
    }

    return (
      <View style={styles.container}>
        <BarCodeScanner
          onLayout={this.setCanvasDimensions}
          onBarCodeScanned={this.handleBarCodeScanned}
          barCodeTypes={[
            BarCodeScanner.Constants.BarCodeType.qr,
            BarCodeScanner.Constants.BarCodeType.pdf417,
            BarCodeScanner.Constants.BarCodeType.code128,
            BarCodeScanner.Constants.BarCodeType.code39,
          ]}
          type={this.state.type}
          style={styles.preview}
        />

        {this.state.haveDimensions && (
          <Svg.Svg height={this.state.canvasHeight} width={this.state.canvasWidth} style={styles.svg}>
            <Svg.Circle
              cx={this.state.canvasWidth! / 2}
              cy={this.state.canvasHeight! / 2}
              r={2}
              strokeWidth={2.5}
              stroke="#e74c3c"
github lightninglabs / lightning-app / src / component / qrcode-scanner.js View on Github external
} else if (hasCameraPermission === false) {
      return (
        <View style={[styles.wrapper, styles.noPermission]}>
          <Text style={styles.text}>
            No access to the camera. You must enable permission on your device.
          </Text>
        </View>
      );
    } else {
      return (
        <View style={styles.wrapper}>
          <BarCodeScanner
            onBarCodeScanned={
              scanned ? undefined : (...args) => this.handleCodeScanned(...args)
            }
            barCodeTypes={[BarCodeScanner.Constants.BarCodeType.qr]}
            style={StyleSheet.absoluteFill}
          />
          <Corners />
        </View>
      );
    }
  }
}

expo-barcode-scanner

Allows scanning variety of supported barcodes both as standalone module and as extension for expo-camera. It also allows scanning barcodes from existing images.

MIT
Latest version published 3 months ago

Package Health Score

86 / 100
Full package analysis

Similar packages