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.04k stars 1.73k forks source link

BoxView will not render on iOS if it's parent is not visible when the page is built, but is made visible afterwards. #18587

Open derlidio opened 11 months ago

derlidio commented 11 months ago

Description

A BoxView inside a Grid, which is not visible at the moment the page is built, will not render when that Grid is made visible.

Steps to Reproduce

  1. Clone the sample repository;
  2. Build the app and run it on iOS 17 (simulator);
  3. Tap the counter button.

On the main page, there are 2 Grids. They have the exact same content. The only difference is: one is visible, the other is not. When you tap the button, they will switch their visibility status. The Grid that was visible at the time the page was built will render fine on subsequent taps. The Grid that was invisible at the moment the page was built will never render (will render a black box).

Link to public reproduction project repository

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

Version with bug

8.0.0-rc.2.9511

Is this a regression from previous behavior?

Yes, this used to work in Xamarin.Forms

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS 17

Did you find any workaround?

Could not find a workaround for that yet.

Relevant log output

No response

ghost commented 10 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.

XamlTest commented 10 months ago

Verified this on Visual Studio Enterprise 17.8.0 Preview 7.0(8.0.0-rc.2.9530). Repro on iOS 16.4, not repro on Windows 11 and Android 14.0-API34 with below Project: BoxViewBug.zip

letscodewithkalyan commented 3 months ago

I got same issue in my project when I changed BoxView with "BackgroundColor" to "Color" it worked fine. Because BoxView, its color is controlled by Color instead of BackgroundColor. Link helped me https://learn.microsoft.com/en-us/answers/questions/1184505/what-is-the-recommended-way-to-draw-a-net-maui-hor

derlidio commented 3 months ago

@letscodewithkalyan Sincerely, I'm giving up on MAUI. This isn't the only layout issue I've reported; there are others, even more serious, that have already been reported and remain unresolved, such as issue #18036 and issue #15649.