File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,12 @@ export default function BarcodeScannerPage() {
14
14
const [ toast , setToast ] = React . useState < string | undefined > ( undefined ) ;
15
15
16
16
const onBarcodesDetected = ( result : BarcodeScannerResultWithSize ) => {
17
- setToast ( JSON . stringify ( result ) ) ;
17
+
18
+ let text = "" ;
19
+ result . barcodes . forEach ( ( barcode ) => {
20
+ text += `${ barcode . text } (${ barcode . format } )\n` ;
21
+ } ) ;
22
+ setToast ( text ) ;
18
23
} ;
19
24
20
25
useEffect ( ( ) => {
Original file line number Diff line number Diff line change @@ -10,7 +10,16 @@ export default function VINScannerPage() {
10
10
const [ toast , setToast ] = React . useState < string | undefined > ( undefined ) ;
11
11
12
12
const onTextDetected = ( result : VinScannerResult ) => {
13
- setToast ( JSON . stringify ( result ) ) ;
13
+
14
+ let text = "" ;
15
+
16
+ if ( result . barcodeResult . extractedVIN ) {
17
+ text += `Barcode: ${ result . barcodeResult . extractedVIN } \n` ;
18
+ }
19
+ if ( result . textResult . rawText ) {
20
+ text += `Text: ${ result . textResult . rawText } (${ result . textResult . confidence . toFixed ( 2 ) } %)\n` ;
21
+ }
22
+ setToast ( text ) ;
14
23
} ;
15
24
16
25
useEffect ( ( ) => {
You can’t perform that action at this time.
0 commit comments