Skip to content

[Android] OnSizeAllocated event not fired for Android shell - fix#31035

Closed
kubaflo wants to merge 1 commit intodotnet:mainfrom
kubaflo:fix-31020
Closed

[Android] OnSizeAllocated event not fired for Android shell - fix#31035
kubaflo wants to merge 1 commit intodotnet:mainfrom
kubaflo:fix-31020

Conversation

@kubaflo
Copy link
Copy Markdown
Contributor

@kubaflo kubaflo commented Aug 6, 2025

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Description

I've made the Android implementation to mirror the behavior of the iOS version shown below for consistency across platforms.
Screenshot 2025-08-06 at 02 17 34

Issues Fixed

Fixes #31020

Copilot AI review requested due to automatic review settings August 6, 2025 00:16
@kubaflo kubaflo requested a review from a team as a code owner August 6, 2025 00:16
@kubaflo kubaflo changed the title [Android] OnSizeAllocated event not fired for Android shell [Android] OnSizeAllocated event not fired for Android shell - fix Aug 6, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a 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 OnSizeAllocated event was not being fired for Android Shell applications. The fix ensures that layout changes in the Shell's flyout renderer properly trigger the cross-platform layout system.

  • Overrides the OnLayout method in ShellFlyoutRenderer to propagate layout changes to the Shell
  • Updates the public API to reflect the new method override

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
ShellFlyoutRenderer.cs Adds OnLayout override to trigger Shell layout updates when the flyout renderer's layout changes
PublicAPI.Unshipped.txt Documents the new public API surface for the OnLayout method override
Comments suppressed due to low confidence (1)

src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellFlyoutRenderer.cs:315

  • [nitpick] The variable name 'destination' is unclear in this context. Consider renaming it to 'layoutRect' or 'shellBounds' to better indicate it represents the layout bounds for the Shell.
			var destination = Context.ToCrossPlatformRectInReferenceFrame(left, top, right, bottom);

@kubaflo kubaflo self-assigned this Aug 6, 2025
@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Aug 6, 2025
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

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

@kubaflo kubaflo added platform/android area-controls-shell Shell Navigation, Routes, Tabs, Flyout labels Aug 6, 2025
@rmarinho rmarinho requested a review from PureWeen August 6, 2025 09:17
base.OnLayout(changed, left, top, right, bottom);

var destination = Context.ToCrossPlatformRectInReferenceFrame(left, top, right, bottom);
Shell.Layout(destination);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The Layout method has been deprecated on net10

Can you rebase this to NET10 and we can see what this solution would look like on NET10

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.

Here's what I've discovered #31056

@kubaflo kubaflo changed the base branch from main to net10.0 August 6, 2025 22:40
@kubaflo kubaflo changed the base branch from net10.0 to main August 6, 2025 22:41
@PureWeen PureWeen added this to the .NET 10 SR1 milestone Oct 6, 2025
@PureWeen PureWeen modified the milestones: .NET 10 SR1, .NET 10.0 SR2 Nov 4, 2025
@PureWeen PureWeen modified the milestones: .NET 10.0 SR2, .NET 10 SR4 Dec 13, 2025
@PureWeen PureWeen modified the milestones: .NET 10.0 SR4, .NET 10 SR5 Jan 21, 2026
@PureWeen PureWeen modified the milestones: .NET 10 SR5, .NET 10 SR6 Mar 3, 2026
@kubaflo
Copy link
Copy Markdown
Contributor Author

kubaflo commented Mar 6, 2026

No needed

@kubaflo kubaflo closed this Mar 6, 2026
@github-project-automation github-project-automation bot moved this from Todo to Done in MAUI SDK Ongoing Mar 6, 2026
@github-actions github-actions bot locked and limited conversation to collaborators Apr 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-controls-shell Shell Navigation, Routes, Tabs, Flyout community ✨ Community Contribution platform/android

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

OnSizeAllocated event not fired for Android when rotating the device

3 participants