react-qr-reader icon indicating copy to clipboard operation
react-qr-reader copied to clipboard

Cannot read properties of null (reading: 'videoWidth') - Windows

Open robertmitidoi opened this issue 2 years ago • 5 comments

Hello everyone,

I started using the react-qr-reader library and for v2.2.0 and v2.2.1 I have a problem with the library, in the index.js file it gives me an error on line 277, the line contains this

var width = Math.floor (legacyMode ? img.naturalWidth : preview.videoWidth);

The problem is after rendering something other than the qr reader component, the "preview" object becomes null and hence the error, while the qr component is being rendered I don't receive anything, I want to make a the interface for reading QR codes and I have some cancel buttons in case you don't want to read the codes and replace the frame with the camera with something else. Also I got this problem on windows laptops, on Linux everything seems to be ok. image image

robertmitidoi avatar Sep 02 '22 07:09 robertmitidoi

Facing the same issue

karman1102 avatar Apr 04 '23 05:04 karman1102

We are also getting the same issue. We did nothing except update packages recently and this error has started to appear since moving to this version.

acuthbert avatar May 02 '23 20:05 acuthbert

Actually scratch that - in fact this package hasn't updated but the error has only started to occur recently so perhaps an issue in other depedancies is causing this?

acuthbert avatar May 02 '23 20:05 acuthbert

I experienced an issue only on localhost. When the app was deployed, this issue didn't occur anymore.

Davidkramer1999 avatar Jun 01 '23 08:06 Davidkramer1999

I'm also facing this issue. Any update on this?

saw1232582000 avatar Nov 26 '23 15:11 saw1232582000