Skip to content

Landscape highlights problem #51

@pedroafsouza

Description

@pedroafsouza

The current library works great. However, when put in landscape the highlights are a bit mess. Do you have any suggestion?
Image

export const CameraCapture = ({ onBarcodeScanned }: ICameraCaptureProps) => {
  const handleBarcodeScanned = Worklets.createRunOnJS(onBarcodeScanned);

  const { props: cameraProps, highlights } = useBarcodeScanner({
    fps: 5,
    onBarcodeScanned: (barcodes) => {
      'worklet';
      const barcodesData: string[] = barcodes.map(({ value }) => value || '');
      handleBarcodeScanned(barcodesData);
    },
  });
  const styles = useStyles(cameraStyles);
  const devices = useCameraDevices();
  const device = devices.find(({ position }) => position === 'back');
  const format = useCameraFormat(device, [
    { videoResolution: { width: 1920, height: 1080 } },
  ]);
  if (!device) {
    return null;
  }

  return (
    <>
      <Camera
        style={styles.camera}
        device={device}
        isActive
        enableZoomGesture={true}
        {...cameraProps}
        format={format}
      />
      <CameraHighlights highlights={highlights} color="peachpuff" />
    </>
  );
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions