dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.21k stars 1.75k forks source link

Changing HeightRequest do not trigger SizeChanged on Android. #18694

Open derlidio opened 12 months ago

derlidio commented 12 months ago

Description

The attached repo contains a simple custom control that shows a yellow box. The control's height is calculated based on its width, and the adjustment is made on its SizeChanged event listener. On iOS and Catalyst this works fine. On Android, it does't. Changes to HeightRequest do not re-trigger the event (nor updates the control size or visual). Not tested on other platforms.

Steps to Reproduce

  1. Clone the attached repo;
  2. Build and run on Android Emulator;

A yellow box should appear under the welcome message (but it doesn't). It should also print two messages to the Application Output Window, but only one will appear (cos SizeChanged will trigger only once). If you run on iOS Simulator or Catalyst, it will act accordingly, showing the yellow box and firing SizeChanged twice.

Link to public reproduction project repository

https://github.com/derlidio/HeightBug.git

Version with bug

8.0.0-rc.2.9511 Microsoft. Maui.Controls - 8.0.0-rc.2.9530 Microsoft.Maui.Controls.Compatibility - 8.0.0-rc.2.9530

Is this a regression from previous behavior?

Yes, this used to work in Xamarin.Forms

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Tested on Pixel 3a API 32

Did you find any workaround?

No response

Relevant log output

No response

ghost commented 12 months ago

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.

AnnYang01 commented 12 months ago

Verified this on Visual Studio Enterprise 17.8.0 Preview 7.0 using below Project (dotnet version is 8.0.100-rc.2.23502.2). Repro on Android 14.0-API34, not repro on Windows 11. HeightBug-main.zip Repro on Android 14.0-API34. image Not repro on Windows 11 image

NataliaSemeniak commented 10 months ago

Facing the same issue on iOS platform when visibility of child element is changed. This used to work in Xamarin.Forms. Tested on iPhone 14 Pro Max iOS 16.4