a7medev / react-native-ml-kit

React Native On-Device Machine Learning w/ Google ML Kit
MIT License
342 stars 55 forks source link

Add barcode raw value #39

Open Iuriy-Budnikov opened 9 months ago

Iuriy-Budnikov commented 9 months ago

What happened?

BarcodeScanning.m

[result addObject:@{
  @"value": barcode.displayValue,
  @"format": format,
  @"rawValue": barcode.rawValue
 }];

BarcodeScanningModule.java

public void onSuccess(List<Barcode> barcodes) {
  WritableArray result = Arguments.createArray();
  for (Barcode barcode : barcodes) {
      WritableMap map = Arguments.createMap();
      map.putString("value", barcode.getDisplayValue());
      map.putDouble("format", barcode.getFormat());
      map.putString("rawValue", barcode.getRawValue());
      result.pushMap(map);
  }
  promise.resolve(result);
}

TS

export interface Barcode {
  format: BarcodeFormat;
  value: string;
  rawValue: string;
}

Could you please add a getRawValue. Thanks

Version

@react-native-ml-kit/barcode-scanning: version@react-native-ml-kit/face-detection: version@react-native-ml-kit/identify-languages: version@react-native-ml-kit/image-labeling: version@react-native-ml-kit/text-recognition: version@react-native-ml-kit/translate-text: version

Which ML Kit packages do you use?

What platforms are you seeing this issue on?

System Information

Check prev message

Steps to Reproduce

Check prev message