Skip to content
This repository was archived by the owner on Mar 28, 2022. It is now read-only.
This repository was archived by the owner on Mar 28, 2022. It is now read-only.

Uncaught TypeError: Cannot read property 'getScreenshot' of null at BarcodeScannerComponent.js:8 #18

@rickwh77

Description

@rickwh77

I am having an issue with getting this error when using a ternary operator to hide the barcode scanner.
image

image

      {showBarcodeReader ?
    <div>
      <BarcodeScannerComponent
        width={500}
        height={500}
        onUpdate={(err, result) => {
          if (result) setData(result.text)
          else setData('Not Found')
        }}
      />
      <p>{data}</p>
      <div>
        <Button
          variant="contained"
          size="large"
          color="primary"
          className={classes.button}
          onClick={handleBarcodeReaderCancel}
        >
          Cancel
        </Button>
      </div>
    </div>
    : null}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions