-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Android] Button with corner radius shadow broken on Android device - fix #29339
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
Changes from all commits
1aae9d3
125c702
80b8d23
0cbf5b9
88a7121
27830a5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| namespace Maui.Controls.Sample.Issues; | ||
|
|
||
| [Issue(IssueTracker.Github, 20596, "[Android] Button with corner radius shadow broken on Android device", PlatformAffected.Android | PlatformAffected.UWP)] | ||
| public class Issue20596 : ContentPage | ||
| { | ||
| public Issue20596() | ||
| { | ||
| var button = new Button | ||
| { | ||
| TextColor = Colors.Black, | ||
| HeightRequest = 200, | ||
| WidthRequest = 200, | ||
| BackgroundColor = Colors.Green, | ||
| CornerRadius = 20, | ||
| Shadow = new Shadow { Radius = 10 } | ||
| }; | ||
|
|
||
| var imageButton = new ImageButton | ||
| { | ||
| HeightRequest = 200, | ||
| WidthRequest = 200, | ||
| BackgroundColor = Colors.Red, | ||
| CornerRadius = 20, | ||
| Shadow = new Shadow { Radius = 10 } | ||
| }; | ||
|
|
||
| var updateButton = new Button | ||
| { | ||
| Text = "Update corner radius", | ||
| HeightRequest = 50, | ||
| AutomationId = "UpdateCornerRadiusButton" | ||
| }; | ||
| updateButton.Clicked += (sender, e) => | ||
| { | ||
| button.CornerRadius = 100; | ||
| imageButton.CornerRadius = 100; | ||
| }; | ||
|
|
||
| Content = new VerticalStackLayout | ||
| { | ||
| Children = | ||
| { | ||
| button, | ||
| imageButton, | ||
| updateButton | ||
| } | ||
| }; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| using NUnit.Framework; | ||
| using UITest.Appium; | ||
| using UITest.Core; | ||
|
|
||
| namespace Microsoft.Maui.TestCases.Tests.Issues; | ||
|
|
||
| public class Issue20596 : _IssuesUITest | ||
| { | ||
| public Issue20596(TestDevice testDevice) : base(testDevice) | ||
| { | ||
| } | ||
|
|
||
| public override string Issue => "[Android] Button with corner radius shadow broken on Android device"; | ||
|
|
||
| [Test] | ||
| [Category(UITestCategories.Button)] | ||
| public void ShadowShouldUpdateOnCornerRadiusChange() | ||
| { | ||
| App.WaitForElement("UpdateCornerRadiusButton"); | ||
| App.Click("UpdateCornerRadiusButton"); | ||
| VerifyScreenshot(); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -62,6 +62,11 @@ public static void MapCornerRadius(IImageButtonHandler handler, IButtonStroke bu | |
| { | ||
| handler.PlatformView?.UpdateCornerRadius(buttonStroke); | ||
| handler.UpdateValue(nameof(IImageButton.Padding)); | ||
|
|
||
| if (handler.VirtualView.Shadow is not null) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Verifying if the Shadow is not null, will not invalidate it when setting to null (for example, to dynamically remove a shadow).
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. RIght, but we only need to invalidate it when it is visible when it comes to radius |
||
| { | ||
| handler.UpdateValue(nameof(IImageButton.Shadow)); | ||
| } | ||
| } | ||
|
|
||
| public static void MapPadding(IImageButtonHandler handler, IImageButton imageButton) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pending snapshots already available in the latest build.

Could you commit the images?