ionic-team / ionic-team/capacitor-barcode-scanner

Layout and scanning functionality breaks when rotating iOS device

Open
#58 1 comment 2 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
64
Forks
47
Avg merge
1h 55m
Merged PRs (30d)
1

Description

Rotating the scanner from landscape to portrait, using the adaptive option, breaks the layout of the scan area and seems to cause the scanning functionality to stop. Although it does detect barcodes if you open the scanner in either portrait or landscape without rotating the device during scan.

This is how the scanner looks when entering in portrait (detecting barcodes works):

![Image](https://github.com/user-attachments/assets/d6c4a4f5-4218-4fc7-9f7d-90ac12f9d283)
^ iPhone 14 Pro

And this is how the scanner looks when you have rotated from landscape to portrait within the scanner plugin (have not been able to detect barcodes in this state):

![Image](https://github.com/user-attachments/assets/dcefe611-3341-4bfe-93b7-8b335baac311)
^ iPhone 14 Pro

![Image](https://github.com/user-attachments/assets/3ff70206-24b7-4767-933c-96f4007d650f)
^ iPhone 16 Pro Max (notice the right side)

These are the options that I pass in to the scanner:
```
const options: CapacitorBarcodeScannerOptions = {
hint: CapacitorBarcodeScannerTypeHint.CODE_128,
scanInstructions: 'Scan Barcode',
cameraDirection: CapacitorBarcodeScannerCameraDirection.BACK,
scanOrientation: CapacitorBarcodeScannerScanOrientation.ADAPTIVE,
android: {
scanningLibrary: CapacitorBarcodeScannerAndroidScanningLibrary.MLKIT
}
};
```

These are Capacitor + scanner versions (same result in plugin version 1.0.4 with Cap 6)
```
"@capacitor/barcode-scanner": "2.0.0",
"@capacitor/cli": "7.0.1",
"@capacitor/core": "7.0.1",
"@capacitor/ios": "7.0.1",
```

I'm not able to see any logs regarding this issue in Xcode. This was implemented in a fresh Angular project running Angular 17.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.