-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[iOS] Fix for Flyout title is not broken over multiple lines when you rotate your screen. #29171
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
Conversation
|
Hey there @@BagavathiPerumal! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
|
/azp run MAUI-UITests-public |
|
Azure Pipelines successfully started running 1 pipeline(s). |
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.
Pull Request Overview
This PR fixes an issue where the Flyout title was not wrapping correctly when the device rotated by adding explicit Auto Layout constraints in UIContainerCell. Key changes include:
- Adding constraints to platformView in UIContainerCell to fill its container.
- Introducing new test cases in both the shared tests and host app to validate the fix.
- Updating Shell pages in the host app to support testing of various Flyout scenarios.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue15154.cs | Adds a UI test case to verify Flyout text wrapping on orientation change. |
| src/Controls/tests/TestCases.HostApp/Issues/Issue15154.cs | Implements a Shell page with multiple ShellContent instances for testing. |
| src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/UIContainerCell.cs | Fixes the layout issue by adding explicit constraints for platformView. |
| platformView.AccessibilityTraits |= UIAccessibilityTrait.Button; | ||
| platformView.TranslatesAutoresizingMaskIntoConstraints = false; | ||
|
|
||
| ContentView.LeadingAnchor.ConstraintEqualTo(platformView.LeadingAnchor).Active = true; |
Copilot
AI
Apr 25, 2025
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.
For clarity and to better express the intended relationship, consider constraining platformView's LeadingAnchor to ContentView's LeadingAnchor rather than the other way around. This aligns with common Auto Layout practices.
Copilot uses AI. Check for mistakes.
|
/azp run MAUI-UITests-public |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run MAUI-UITests-public |
|
Azure Pipelines successfully started running 1 pipeline(s). |
| platformView.TranslatesAutoresizingMaskIntoConstraints = false; | ||
|
|
||
| var margin = view.Margin; | ||
| platformView.LeadingAnchor.ConstraintEqualTo(ContentView.LeadingAnchor, (nfloat)margin.Left).Active = true; |
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.
Can you create a NSLayoutConstraint[] with all the constraints and then use the method NSLayoutConstraint.ActivateConstraints(constraints); to active all of them at once? Is more efficient than individually.
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.
@jsuarezruiz, I have updated the code based on your suggestion. Could you please share your concerns on this.
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.
Is this snapshot correct? Seems that the first item, the selected one, is clipped.
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.
@jsuarezruiz, This appearance is consistent with the snapshots generated by the CI pipeline. When the device is in horizontal orientation, the CI system appears to crop the top region of iOS snapshots. As a result, similar cropping can be observed across other related test cases. For your reference, please refer to the attached snapshot link.
|
/rebase |
…s instead of truncating in landscape mode.
…e edges of platformView.
…tItem and updated Android snapshot.
…onstraint.ActivateConstraints() for better performance with Shell flyout margins.
0a86ed8 to
99ee7a1
Compare
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
… rotate your screen. (#29171) * fix-15154-Added proper Auto Layout constraints to ensure content wraps instead of truncating in landscape mode. * fix-15154-Prepared the testcase and snapshot added for android and iOS. * fix-15154-Modified the test condition. * fix-15154-Modified the code to align the edges of ContentView with the edges of platformView. * fix-15154-Adjusted inset constraints to respect view margins in FlyoutItem and updated Android snapshot. * fix-15154-Replaced individual .Active=true calls with batch NSLayoutConstraint.ActivateConstraints() for better performance with Shell flyout margins.
… rotate your screen. (#29171) * fix-15154-Added proper Auto Layout constraints to ensure content wraps instead of truncating in landscape mode. * fix-15154-Prepared the testcase and snapshot added for android and iOS. * fix-15154-Modified the test condition. * fix-15154-Modified the code to align the edges of ContentView with the edges of platformView. * fix-15154-Adjusted inset constraints to respect view margins in FlyoutItem and updated Android snapshot. * fix-15154-Replaced individual .Active=true calls with batch NSLayoutConstraint.ActivateConstraints() for better performance with Shell flyout margins.
… rotate your screen. (#29171) * fix-15154-Added proper Auto Layout constraints to ensure content wraps instead of truncating in landscape mode. * fix-15154-Prepared the testcase and snapshot added for android and iOS. * fix-15154-Modified the test condition. * fix-15154-Modified the code to align the edges of ContentView with the edges of platformView. * fix-15154-Adjusted inset constraints to respect view margins in FlyoutItem and updated Android snapshot. * fix-15154-Replaced individual .Active=true calls with batch NSLayoutConstraint.ActivateConstraints() for better performance with Shell flyout margins.
… rotate your screen. (#29171) * fix-15154-Added proper Auto Layout constraints to ensure content wraps instead of truncating in landscape mode. * fix-15154-Prepared the testcase and snapshot added for android and iOS. * fix-15154-Modified the test condition. * fix-15154-Modified the code to align the edges of ContentView with the edges of platformView. * fix-15154-Adjusted inset constraints to respect view margins in FlyoutItem and updated Android snapshot. * fix-15154-Replaced individual .Active=true calls with batch NSLayoutConstraint.ActivateConstraints() for better performance with Shell flyout margins.
… rotate your screen. (#29171) * fix-15154-Added proper Auto Layout constraints to ensure content wraps instead of truncating in landscape mode. * fix-15154-Prepared the testcase and snapshot added for android and iOS. * fix-15154-Modified the test condition. * fix-15154-Modified the code to align the edges of ContentView with the edges of platformView. * fix-15154-Adjusted inset constraints to respect view margins in FlyoutItem and updated Android snapshot. * fix-15154-Replaced individual .Active=true calls with batch NSLayoutConstraint.ActivateConstraints() for better performance with Shell flyout margins.
… rotate your screen. (#29171) * fix-15154-Added proper Auto Layout constraints to ensure content wraps instead of truncating in landscape mode. * fix-15154-Prepared the testcase and snapshot added for android and iOS. * fix-15154-Modified the test condition. * fix-15154-Modified the code to align the edges of ContentView with the edges of platformView. * fix-15154-Adjusted inset constraints to respect view margins in FlyoutItem and updated Android snapshot. * fix-15154-Replaced individual .Active=true calls with batch NSLayoutConstraint.ActivateConstraints() for better performance with Shell flyout margins.
… rotate your screen. (#29171) * fix-15154-Added proper Auto Layout constraints to ensure content wraps instead of truncating in landscape mode. * fix-15154-Prepared the testcase and snapshot added for android and iOS. * fix-15154-Modified the test condition. * fix-15154-Modified the code to align the edges of ContentView with the edges of platformView. * fix-15154-Adjusted inset constraints to respect view margins in FlyoutItem and updated Android snapshot. * fix-15154-Replaced individual .Active=true calls with batch NSLayoutConstraint.ActivateConstraints() for better performance with Shell flyout margins.
… rotate your screen. (#29171) * fix-15154-Added proper Auto Layout constraints to ensure content wraps instead of truncating in landscape mode. * fix-15154-Prepared the testcase and snapshot added for android and iOS. * fix-15154-Modified the test condition. * fix-15154-Modified the code to align the edges of ContentView with the edges of platformView. * fix-15154-Adjusted inset constraints to respect view margins in FlyoutItem and updated Android snapshot. * fix-15154-Replaced individual .Active=true calls with batch NSLayoutConstraint.ActivateConstraints() for better performance with Shell flyout margins.
For more information about inflight process check https://github.com/dotnet/maui/wiki/Inflight-Branch-Process # .NET MAUI Release Notes - inflight/candidate Branch ## MAUI Product Fixes * [iOS] Fix SwipeView programmatic open when background color is set by @Shalini-Ashokan in #29765 * [iOS] FormattedText with text color causes stack overflow - fix by @kubaflo in #29874 * [iOS] Fix AdaptiveTrigger not working as expected by @jsuarezruiz in #20987 * [iOS] Fix for Flyout title is not broken over multiple lines when you rotate your screen by @BagavathiPerumal in #29171 * [Windows] Fix for Assigning null to the SelectedItem of the CollectionView in the SelectionChanged event does not clear the selection by @SyedAbdulAzeemSF4852 in #29288 * Fix TapCoordinates method in Catalyst by @jsuarezruiz in #29775 * Fixed ItemSpacing on CarouselView resizes items [Android] by @Dhivya-SF4094 in #29796 * Perf : ButtonContentTypeConverter now using InvariantCulture to parse double by @antoine-jonathan in #25393 * ToolbarItem behavior with ImageSource iOS - fix by @kubaflo in #28833 * [Android] Fixed Button Shadow Color Transparency Not Applied Correctly by @NanthiniMahalingam in #29371 * Don't call NSAttributedString with HTML from a background thread by @kubaflo in #26153 * [Windows] Implemented the Resize and Downsize functions in the W2DImage class by @HarishwaranVijayakumar in #29138 * Templated indicator view - improvements by @kubaflo in #25642 * Update Issue25946.xaml by @anandhan-rajagopal in #30025 ## Testing * Fixed Test case failure in PR 26153 - iOS by @kubaflo in #29906 * Fixed Test case failure in PR 25642 - snapshots by @kubaflo in #29881 * [Testing] Feature Matrix UITest Cases for RadioButton by @TamilarasanSF4853 in #29744 * [Testing] Feature Matrix UITest Cases for CollectionView ItemsSource Feature by @LogishaSelvarajSF4525 in #29322 * [Testing] Feature Matrix UITest Cases for Stepper by @nivetha-nagalingam in #29731 * [Testing] Feature Matrix UITest Cases for CheckBox Control by @anandhan-rajagopal in #29739 * Update the comment for the test properties by @mattleibow in #27306 ## Dependency Updates * No changes in this category ## Docs * No changes in this category ## Housekeeping * [create-pull-request] automated change by @github-actions[bot] in #29875 * [create-pull-request] automated change by @github-actions[bot] in #29792 * [create-pull-request] automated change by @github-actions[bot] in #29760 **Full Changelog**: origin/main...origin/inflight/candidate
… rotate your screen. (#29171) * fix-15154-Added proper Auto Layout constraints to ensure content wraps instead of truncating in landscape mode. * fix-15154-Prepared the testcase and snapshot added for android and iOS. * fix-15154-Modified the test condition. * fix-15154-Modified the code to align the edges of ContentView with the edges of platformView. * fix-15154-Adjusted inset constraints to respect view margins in FlyoutItem and updated Android snapshot. * fix-15154-Replaced individual .Active=true calls with batch NSLayoutConstraint.ActivateConstraints() for better performance with Shell flyout margins.
Root cause
The issue originated from missing Auto Layout constraints in the UIContainerCell implementation. Without explicit constraints anchoring the platform view to its container edges, the view failed to properly resize during orientation changes. This constraint deficiency prevented iOS from accurately calculating available width when transitioning to landscape mode, causing text content to be cropped rather than wrapped appropriately.
Description of Issue Fix
The fix ensures proper layout by applying Auto Layout constraints that correctly position the platformView within its parent container, accounting for the specified margin values. By setting TranslatesAutoresizingMaskIntoConstraints to false, the platformView is aligned using explicit constraints on all edges (leading, trailing, top, and bottom) relative to the ContentView. This approach ensures the platformView respects its margins and resizes appropriately during orientation changes.
This ensures that any text elements within the view have the correct width information to wrap text appropriately in both portrait and landscape orientations.
Tested the behavior in the following platforms.
Issues Fixed
Fixes #15154
Output
BeforeFix-FlyoutText.mov
AfterFix-FlyoutText.mov