How to use expo-barcode-scanner - 10 common examples

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

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github flow-typed / flow-typed / definitions / npm / expo-barcode-scanner_v5.x.x / flow_v0.104.x- / test_expo-barcode-scanner.js View on Github external
it('should raises an error when call with invalid args', () => {
      // $ExpectError: first argument is required
      BarCodeScanner.scanFromURLAsync();

      // $ExpectError: first argument must be a string
      BarCodeScanner.scanFromURLAsync(123);

      // $ExpectError: second argument must be an array
      BarCodeScanner.scanFromURLAsync('url', 123);

      BarCodeScanner.scanFromURLAsync('url', [
        // $ExpectError: invalid barcode type
        123,
      ]);
    });
  });
github flow-typed / flow-typed / definitions / npm / expo-barcode-scanner_v5.x.x / flow_v0.104.x- / test_expo-barcode-scanner.js View on Github external
it('should raises an error when call with invalid args', () => {
      // $ExpectError: first argument is required
      BarCodeScanner.scanFromURLAsync();

      // $ExpectError: first argument must be a string
      BarCodeScanner.scanFromURLAsync(123);

      // $ExpectError: second argument must be an array
      BarCodeScanner.scanFromURLAsync('url', 123);

      BarCodeScanner.scanFromURLAsync('url', [
        // $ExpectError: invalid barcode type
        123,
      ]);
    });
  });
github flow-typed / flow-typed / definitions / npm / expo-barcode-scanner_v5.x.x / flow_v0.104.x- / test_expo-barcode-scanner.js View on Github external
it('should raises an error when call with invalid args', () => {
      // $ExpectError: first argument is required
      BarCodeScanner.scanFromURLAsync();

      // $ExpectError: first argument must be a string
      BarCodeScanner.scanFromURLAsync(123);

      // $ExpectError: second argument must be an array
      BarCodeScanner.scanFromURLAsync('url', 123);

      BarCodeScanner.scanFromURLAsync('url', [
        // $ExpectError: invalid barcode type
        123,
      ]);
    });
  });
github flow-typed / flow-typed / definitions / npm / expo-barcode-scanner_v5.x.x / flow_v0.104.x- / test_expo-barcode-scanner.js View on Github external
it('should pass when call with valid array of BarCodeType', () => {
      BarCodeScanner.scanFromURLAsync('url', [
        Constants.BarCodeType.qr,
        Constants.BarCodeType.aztec,
      ]);
    });
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()}
      
      {this.state.faceDetecting && this.renderFaces()}
      {this.state.faceDetecting && this.renderLandmarks()}
      {this.state.showMoreOptions && this.renderMoreOptions()}
    
  );
github janaagaard75 / expo-and-typescript / src / BarCodeScannerScreen.tsx View on Github external
case PermissionState.Denied:
        return ;

      case PermissionState.Granted:
        return (
          
        );

      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()}
      
      {this.state.faceDetecting && this.renderFaces()}
      {this.state.faceDetecting && this.renderLandmarks()}
      {this.state.showMoreOptions && this.renderMoreOptions()}
    
  );
github bastiRe / eLadder / app / components / base / LeagueScanner.js View on Github external
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};
  }
}
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: '',
  };

  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);

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 8 months ago

Package Health Score

85 / 100
Full package analysis