Skip to content

[Android/iOS] Fix Rectangle Width broken#27280

Closed
devanathan-vaithiyanathan wants to merge 15 commits intodotnet:mainfrom
devanathan-vaithiyanathan:Fix-18628
Closed

[Android/iOS] Fix Rectangle Width broken#27280
devanathan-vaithiyanathan wants to merge 15 commits intodotnet:mainfrom
devanathan-vaithiyanathan:Fix-18628

Conversation

@devanathan-vaithiyanathan
Copy link
Copy Markdown
Contributor

@devanathan-vaithiyanathan devanathan-vaithiyanathan commented Jan 22, 2025

Root Cause

The issue occurs in the Rectangle control, where in the Stretch.Fill case, widthConstraint and heightConstraint are directly assigned to result.Width and result.Height without considering WidthRequest and HeightRequest

Description of Change

Updated the Stretch.Fill logic in Shape.cs to apply the constraints (widthConstraint and heightConstraint) when WidthRequest and HeightRequest are less than 0; otherwise, it uses the specified WidthRequest and HeightRequest.

Issues Fixed

Fixes #18628

Tested the behavior in the following platforms.

  • Android
  • Windows
  • iOS
  • Mac

Output Screenshot

Before After
Android
Android
iOS
iOS

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Jan 22, 2025
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Hey there @devanathan-vaithiyanathan! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@devanathan-vaithiyanathan
Copy link
Copy Markdown
Contributor Author

@dotnet-policy-service terminate

@devanathan-vaithiyanathan
Copy link
Copy Markdown
Contributor Author

@dotnet-policy-service agree company="Syncfusion, Inc."

@karthikraja-arumugam karthikraja-arumugam added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Jan 22, 2025
@jsuarezruiz
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

if (!double.IsInfinity(heightConstraint))
{
result.Height = heightConstraint;
result.Height = HeightRequest < 0 ? heightConstraint : HeightRequest;
Copy link
Copy Markdown
Contributor

@MartyIX MartyIX Jan 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR is described as "modifying for Android/iOS" but this change affects all platforms, or not?

Copy link
Copy Markdown
Contributor Author

@devanathan-vaithiyanathan devanathan-vaithiyanathan Jan 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MartyIX Yes, these changes affect all the platforms. Windows is working properly even when the parent constraint size is returned to the shape, as the framework itself considers the defined size for the native view and returns the proper size for the drawing area. However, Android and iOS determine the size based on this measured value. We have ensured that the UI is now consistently rendered across all platforms

@jsuarezruiz
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@jsuarezruiz
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

[Category(UITestCategories.Shape)]
public void VerifyRectangleWidth()
{
App.WaitForElement("Rectangle");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test is failing on Windows:

   at UITest.Appium.HelperExtensions.Wait(Func`1 query, Func`2 satisfactory, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 2311
   at UITest.Appium.HelperExtensions.WaitForAtLeastOne(Func`1 query, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 2326
   at UITest.Appium.HelperExtensions.WaitForElement(IApp app, String marked, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency, Nullable`1 postTimeout) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 663
   at Microsoft.Maui.TestCases.Tests.Issues.Issue18628.VerifyRectangleWidth() in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue18628.cs:line 19
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion, I have modified the test to resolve the issue.

@jsuarezruiz
Copy link
Copy Markdown
Contributor

/azp run

@jsuarezruiz
Copy link
Copy Markdown
Contributor

/rebase

@devanathan-vaithiyanathan
Copy link
Copy Markdown
Contributor Author

This PR changes are included in the PR #27451 . Hence closing this PR

@github-actions github-actions bot locked and limited conversation to collaborators Mar 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/android platform/ios

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Android][iOS/Catalyst] Rectangle rendering is broken

4 participants