Git Product home page Git Product logo

quagga2-react-example's Introduction

quagga2-react-example

Showcasing Quagga2 in combination with ReactJS

This project was bootstrapped with Create React App.

Available Scripts

In the project directory, you can run:

npm start

Runs the app in the development mode.
Open http://localhost:3000 to view it in your browser.

The page will reload when you make changes.
You may also see any lint errors in the console.

npm test

Launches the test runner in the interactive watch mode.
See the section about running tests for more information.

npm run build

Builds the app for production to the build folder.
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.
Your app is ready to be deployed!

See the section about deployment for more information.

npm run eject

Note: this is a one-way operation. Once you eject, you can't go back!

If you aren't satisfied with the build tool and configuration choices, you can eject at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except eject will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.

You don't have to ever use eject. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.

Learn More

You can learn more in the Create React App documentation.

To learn React, check out the React documentation.

Code Splitting

This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting

Analyzing the Bundle Size

This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size

Making a Progressive Web App

This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app

Advanced Configuration

This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration

Deployment

This section has moved here: https://facebook.github.io/create-react-app/docs/deployment

npm run build fails to minify

This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify

quagga2-react-example's People

Contributors

amsimoes avatar dependabot[bot] avatar ericblade avatar serratus avatar snyk-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

quagga2-react-example's Issues

License is absent

I would like to use part of this code example in my project. What is the license of this code?

Uncaught TypeError: Cannot read property 'code' of undefined

Hey all!

I'm getting this error just after the Scanner detecting the barcode (box drawn), and the screen goes white:

Uncaught TypeError: Cannot read property 'code' of undefined
    at eval (App.js?afc7:14)
    at Array.map (<anonymous>)
    at App (App.js?afc7:13)
    at renderWithHooks (react-dom.development.js?61bb:14797)
    at updateFunctionComponent (react-dom.development.js?61bb:17016)
    at beginWork (react-dom.development.js?61bb:18591)
    at HTMLUnknownElement.callCallback (react-dom.development.js?61bb:184)
    at Object.invokeGuardedCallbackDev (react-dom.development.js?61bb:236)
    at invokeGuardedCallback (react-dom.development.js?61bb:289)
    at beginWork$1 (react-dom.development.js?61bb:23203)

Is this broken or is it specific to the Barcode I tried to scan?
Do I need to update something in the code?

Thanks!

quagga no longer uses reader as an option

https://github.com/ericblade/quagga2-react-example/blob/master/src/components/Scanner.js#L100

this results that quagga will never find a result.

I've replaced it with the example from instruction
{ readers: [ 'ean_reader' ], debug: { drawBoundingBox: false, showFrequency: false, drawScanline: false, showPattern: false } multiple: false }
seemed to work, but now gota tweak the results to make sure they display properly.

thanks for this example, learned quiet alot from it!

Is this an active project?

Has anyone used this example recently, with any success... with React 18?

I just tried and got a bunch of (deprecated) package warnings and ultimately the following error:

opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'

Thanks in advance

Project doesn't start right away

Thanks for the work on this repository, but if I use the
npm run start
command, the project gives an error in Scanner.js, because it's used the validated variable, which is given by one of two possible definitons not implemented:

                // const validated = barcodeValidator(result.codeResult.code);
                // const validated = validateBarcode(result.codeResult.code);
                // Quagga.ImageDebug.drawPath(result.line, { x: 'x', y: 'y' }, drawingCtx, { color: validated ? 'green' : 'red', lineWidth: 3 });
                drawingCtx.font = "24px Arial";
                drawingCtx.fillStyle = validated ? 'green' : 'red';
                drawingCtx.fillText(`${result.codeResult.code} valid: ${validated}`, 10, 50);
                drawingCtx.fillText(result.codeResult.code, 10, 20);
                // if (validated) {
                //     onDetected(result);
                // }
            }````

Am I missing something on this barcodeValidator or validateBarcode function? 

Vue Example

Hi Sir,

Wow, this is a great component, with very well written documentation.
Thanks for sharing your knowledge !

Can you please tell us how to use your component with Vue ?
Example code maybe ?
(I really don't have any React knowledge)

Thanks in advance for any effort.

Warning: findDOMNode is deprecated in StrictMode. findDOMNode

Warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of Transition which is inside StrictMode. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-find-node

Is there a way of solving this for quagga2?

Hooks instead of Scanner component

It's a really good example here and I learned a lot from this. However, it might be better if you can make it a hook instead of a component, as the component doesn't really return any JSX element. Like useScanner or useBarcode and accept some parameters maybe. I might be able to pull a request if you need it. (or maybe no)

Cannot read property 'ImageWrapper' of undefined at self.onmessage

First thank you for this up to date example. I did integrate this example into my current project. But I see following error on Scanner initialization:

Uncaught TypeError: Cannot read property 'ImageWrapper' of undefined
    at self.onmessage (32307bc5-fa37-40af-a651-728171f8522c:30)

My first guess is: this is Webpack related, but since example's configuration is quite simple, and my project is not, I haven't figure out what difference will cause this?

My second guess is: I do initialize Quagga in a modal, and that might be a problem?

I appropriate any light on this in advance, thanks.

p.s. This is what I see after I click on error link:

(function rn(t) {
      if (t) {
        var n = t().default;
        if (!n) return void self.postMessage({
          event: "error",
          message: "Quagga could not be created"
        });
      }
...
      self.onmessage = function (t) {
        if ("init" === t.data.cmd) {
          var i = t.data.config;
          i.numOfWorkers = 0, e = new n.ImageWrapper({
            x: t.data.size.x,
            y: t.data.size.y
          }, new Uint8Array(t.data.imageData)), n.init(i, o, e), n.onProcessed(r);
        } else "process" === t.data.cmd ? (e.data = new Uint8Array(t.data.imageData), n.start()) : "setReaders" === t.data.cmd ? n.setReaders(t.data.readers) : "registerReader" === t.data.cmd && n.registerReader(t.data.name, t.data.reader);
      };

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on Greenkeeper branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.

Since we didn’t receive a CI status on the greenkeeper/initial branch, it’s possible that you don’t have CI set up yet.
We recommend using:

If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/.

Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please click the 'fix repo' button on account.greenkeeper.io.

always show not detected

Thank you for creating this package

but i faced issue when i using upload and then start to decode the barcode, it always show not detected,

decoder: {
readers: ['code_39_reader']
},

example barcode
barcode

full code
  const onChange = e => {
    const file = e.target.files[0];
    const reader = new FileReader();
    reader.onload = function(event) {
      Quagga.decodeSingle(
        {
          decoder: {
            readers: ['code_39_reader'] 
          },
          locate: true,
          src: event.target.result
        },
        function(result) {
          console.log(result);
          if (result.codeResult) {
            console.log('result', result.codeResult.code);
          } else {
            console.log('not detected');
          }
        }
      );
    };
    reader.readAsDataURL(file);
  };

thanks before

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.