react-qr-barcode-scanner 2.1.0 → 2.1.2

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.
Files changed (2) hide show
  1. package/README.md +20 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -84,6 +84,26 @@ Type: `boolean`, Optional
84
84
 
85
85
  Turn the camera flashlight on or off.
86
86
 
87
+ Torch will only work if the correct `facingMode` is selected. For example, if "user" is selected but the flashlight corresponds to the "environment" camera, then it will not turn on.
88
+
89
+ Torch will not turn on if a static value of `true` is passed. The initial value must be `false`, and then switched to `true` after a timeout or after a user action.
90
+
91
+ Here is an example using a timeout:
92
+ ```
93
+ const [torchEnabled, setTorchEnabled] = useState<boolean>(false);
94
+
95
+ useEffect(() => {
96
+ setTimeout(() => {
97
+ setTorchEnabled(true);
98
+ }, 2000);
99
+ }, []);
100
+
101
+ <BarcodeScanner
102
+ torch={torchEnabled}
103
+ onUpdate={(err, result) => {}}
104
+ />
105
+ ```
106
+
87
107
  ### delay
88
108
 
89
109
  Type: `number`, Optional, Default: `500`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-qr-barcode-scanner",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
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",