BarcodeScanner.Mobile
BarcodeScanner.Mobile copied to clipboard
CameraView overlapping other views in MAUI (.NET8)
Describe the bug
In MAUI version there are some issues with properly displaying CameraView.
To Reproduce Steps to reproduce the behavior:
- Open MAUI Sample App
- Open MVVM Demo page
- See that
CameraViewis overlapping over controls
Expected behavior
CameraView should be displayed correctly in specified sizes, and Preview should fill available space, and crop what's out of the bounds. See Xamarin Forms screenshot
Screenshots
MAUI
Xamarin Forms
Smartphone (please complete the following information):
- Device: Google Pixel
- OS: Android
- Version Maui v8.0.0 (may be on previous too, haven't tested)
Additional context I was trying to find what causes it and created PR to use the new ResolutionSelector, but it didn't fix the issue.
If set _previewView.SetScaleType(PreviewView.ScaleType.FitCenter) in CreatePlatformView - it affects this behavior, but it is not a fix, because it starts to fit the preview instead of filling
Known workarounds
Wrap CameraView into Frame and set ClipToBounds = true , but other issues appear like black camera view after the first scan.
Can confirm, the camera view does all sorts of craziness.
A partial workaround is to wrap CameraView into Frame and set ClipToBounds = true , but other issues appear like a black camera view after first scan.