Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS & Mac] Gradient background size is incorrect when invalidating parent #26057

Open
RanjithkumarSyncfusion opened this issue Nov 22, 2024 · 1 comment
Assignees
Labels
platform/iOS 🍎 platform/macOS 🍏 macOS / Mac Catalyst s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working

Comments

@RanjithkumarSyncfusion
Copy link

Description

When invalidating a parent, gradient applied to the child fills the entire screen.

In my example, I have a Grid with 2 Rows(40,*) and loaded a button as first row with LinearGradientBrush.
When calling Grid.InvalidateMeasure(), the gradient size fills the entire screen.

Steps to Reproduce

  1. Run the attached sample.
  2. Click anywhere outside the Button.
    Gradient.zip

Link to public reproduction project repository

No response

Version with bug

9.0.10 SR1

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

iOS, macOS

Affected platform versions

No response

Did you find any workaround?

Yes
Rename the gradient relevant layer name to skip size updating for this particaluar layer alone.
private void ButtonLoaded(object? sender, EventArgs e)
{
#if IOS
if(sender is Button button && button.Handler != null && button.Handler.PlatformView != null && button.Handler.PlatformView is UIKit.UIView platformView)
{
if(platformView.Layer != null && platformView.Layer.Sublayers != null)
{
if(platformView.Layer != null && platformView.Layer.Sublayers != null)
{
var layer = platformView.Layer.Sublayers.FirstOrDefault(x => x.Name == "MauiBackgroundLayer");
if( layer != null && layer is CALayer gradientLayer)
{
gradientLayer.Name = "GradientLayer";
}
}
}
}
#endif

Relevant log output

@RanjithkumarSyncfusion RanjithkumarSyncfusion added the t/bug Something isn't working label Nov 22, 2024
@vishnumenon2684 vishnumenon2684 self-assigned this Nov 25, 2024
@Zhanglirong-Winnie Zhanglirong-Winnie added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Nov 26, 2024
@Zhanglirong-Winnie
Copy link

Zhanglirong-Winnie commented Nov 26, 2024

This issue has been verified using Visual Studio Code (9.0.10 & 9.0.0 ). Can repro this issue on iOS and macOS platforms.
Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform/iOS 🍎 platform/macOS 🍏 macOS / Mac Catalyst s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants