react-qr-barcode-scanner 2.1.5 → 2.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -42,6 +42,19 @@ function App() {
42
42
  export default App;
43
43
  ```
44
44
 
45
+ ## Usage in NextJS:
46
+
47
+ ```jsx
48
+ import dynamic from "next/dynamic"
49
+
50
+ const BarcodeScanner = dynamic(
51
+ () => import("react-qr-barcode-scanner"),
52
+ { ssr: false }
53
+ )
54
+
55
+ // ... same as before
56
+ ```
57
+
45
58
  ## Props
46
59
 
47
60
  ### onUpdate
@@ -1,3 +1,4 @@
1
+ import React from "react";
1
2
  import { BarcodeFormat, Result } from "@zxing/library";
2
3
  import { BarcodeStringFormat } from "./BarcodeStringFormat";
3
4
  declare global {
@@ -58,6 +58,6 @@ export const BarcodeScanner = ({ onUpdate, onError, width = "100%", height = "10
58
58
  }, [capture, delay]);
59
59
  return (_jsx(Webcam, { width: width, height: height, ref: webcamRef, screenshotFormat: "image/jpeg", videoConstraints: videoConstraints || {
60
60
  facingMode,
61
- }, audio: false, onUserMediaError: onError }));
61
+ }, audio: false, onUserMediaError: onError, "data-testid": "video" }));
62
62
  };
63
63
  export default BarcodeScanner;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-qr-barcode-scanner",
3
- "version": "2.1.5",
3
+ "version": "2.1.7",
4
4
  "description": "A simple React Component using the client's webcam to read barcodes and QR codes.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -12,7 +12,8 @@
12
12
  "scripts": {
13
13
  "lint": "eslint ./src --ext .js,.jsx,.ts,.tsx --fix",
14
14
  "build": "rm -rf dist && tsc --build tsconfig.json --declaration",
15
- "test": "echo \"Error: no test specified\" && exit 1",
15
+ "test": "vitest",
16
+ "test:coverage": "vitest run --coverage",
16
17
  "release": "standard-version"
17
18
  },
18
19
  "repository": {
@@ -38,16 +39,26 @@
38
39
  "react-webcam": "^7.2.0"
39
40
  },
40
41
  "devDependencies": {
42
+ "@eslint/js": "^9.29.0",
43
+ "@testing-library/dom": "^10.4.0",
44
+ "@testing-library/react": "^16.3.0",
41
45
  "@types/react": "^19.1.2",
42
46
  "@typescript-eslint/eslint-plugin": "^8.30.0",
43
47
  "@typescript-eslint/parser": "^8.30.0",
44
- "eslint": "^9.24.0",
48
+ "@vitest/coverage-v8": "3.2.3",
49
+ "eslint": "^9.29.0",
45
50
  "eslint-plugin-react": "^7.37.5",
51
+ "globals": "^16.2.0",
52
+ "jsdom": "^26.1.0",
53
+ "react": "^19.1.0",
54
+ "react-dom": "^19.1.0",
46
55
  "standard-version": "^9.5.0",
47
- "typescript": "^5.8.3"
56
+ "typescript": "^5.8.3",
57
+ "typescript-eslint": "^8.34.1",
58
+ "vitest": "^3.2.3"
48
59
  },
49
60
  "peerDependencies": {
50
- "react": "^19.1.0",
51
- "react-dom": "^19.1.0"
61
+ "react": ">=18.0.0",
62
+ "react-dom": ">=18.0.0"
52
63
  }
53
64
  }