xamarin / XamarinCommunityToolkit

The Xamarin Community Toolkit is a collection of Animations, Behaviors, Converters, and Effects for mobile development with Xamarin.Forms. It simplifies and demonstrates common developer tasks building iOS, Android, and UWP apps with Xamarin.Forms.
MIT License
1.59k stars 472 forks source link

[Bug] [iOS] CameraView changes it's size in horizontal orientation #2001

Closed Nikclim closed 8 months ago

Nikclim commented 8 months ago

Description

If I make photo and hold device vertical CameraView works correctly. But if I make photo and hold device horizontal (when device camera looks down) or with some angle, CameraView changes it's own size after opening page where I use it. Besides, ImageView, which I use for showing preview, also changes it's own size, if I made photo, while device was held horizontal.

If I lock screen orientation using device button, CameraView works correctly. But locking orientation using Supported device orientations in info.plist and overriding GetSupportedInterfaceOrientations doesn't work.

Stack Trace

Link to Reproduction Sample

Steps to Reproduce

First scenario:

  1. Hold device horizontal
  2. Open page with CameraView.

Expected Behavior

CameraView has declared size.

Actual Behavior

CameraView has lower size than u declared.

Second scenario: (in this case u should use ImageView for showing photo you took)

  1. Hold device vertical
  2. Open page with CameraView.
  3. Hold device horizontal
  4. Make photo

Expected Behavior

ImageView has declared size.

Actual Behavior

imageView has lower size than u declared.

Basic Information

Reproduction imagery

photo1705060603 (1) photo1705060603 (2) photo1705060603 photo1705060663

Code samples (mac zip)

Samples.zip

Nikclim commented 8 months ago

I used to use Device.Info.ScaledScreenSize.Height for setting CameraView height. It caused resizing. Using App.Instance.MainPage.Height resolves issue.