Is barcode scanner scanner result doc up to date?

Hello, I am working on app where I need to use barcode scanner and I have encountered an issue where BarCodeScannerResult type returns a number. From the documentation it should be typed as BarCodeScanner.Constants.BarCodeType. Is there some conversion table for BarCodeType which would give me an string name of code instead of number?

I can see in code that there has been some change to string, but returned type is in form of number converted to string.

export declare type BarCodeScannerResult = {
    type: string;
    data: string;
    bounds?: BarCodeBounds;
    cornerPoints?: BarCodePoint[];
};

Sorry sir But cannot help you.

hey friend did u find a solution i have the same issue i wanted to publish it as a bug in expo but i got lost

I agree it would be good if the BarCodeScanner provided this mapping itself.

But I’ve just tried this and it seems to work. Lightly tested on Android and iOS:

const BarCodeName = Object.fromEntries(
  Object.entries(BarCodeScanner.Constants.BarCodeType).map(([key, val]) => [val, key])
);
console.log(JSON.stringify(BarCodeName));

the problem is the val return a number for exemple for qrcode it return 512 we want a table to map those numbers or just return a type directly

If you use the code in my comment above you will have what you want.
i.e. after running the following code:

const BarCodeName = Object.fromEntries(
  Object.entries(BarCodeScanner.Constants.BarCodeType).map(([key, val]) => [val, key])
);

BarCodeName is the mapping table you are looking for.

Here’s your table:

Barcode Type Mapping Table

1: code128
2: code39
4: code93
8: codabar
16: datamatrix
32: ean13
64: ean8
128: itf14
256: qr
512: upc_a
1024: upc_e
2048: pdf417
4096: aztec