Skip to content

Commit

Permalink
update parsing result data structure
Browse files Browse the repository at this point in the history
  • Loading branch information
iossocket committed Jul 21, 2022
1 parent a62b9fb commit 3c657c3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ public Object callback(@NonNull ImageProxy imageProxy, @NonNull Object[] params)
WritableNativeArray array = new WritableNativeArray();
Image image = imageProxy.getImage();
if (image == null) {
map.putArray("barcode", array);
map.putArray("barcodes", array);
return map;
}
List<String> results = WeChatQRCodeDetector.detectAndDecode(toBitmap(image));
for (String item : results) {
array.pushString(item);
}
map.putArray("barcode", array);
map.putArray("barcodes", array);
return map;
}

Expand Down
3 changes: 1 addition & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
import type { Frame } from "react-native-vision-camera";

declare let _WORKLET: true | undefined;
export function qrcodeProcessorPlugin(frame: Frame): string[] {
export function qrcodeProcessorPlugin(frame: Frame): { barcodes: string[] } {
"worklet";
if (!_WORKLET) throw new Error("qrcodeProcessorPlugin must be called from a frame processor!");
console.log("__qrcode_processor_plugin enter")
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error because this function is dynamically injected by VisionCamera
return __qrcode_processor_plugin(frame);
Expand Down

0 comments on commit 3c657c3

Please sign in to comment.