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

Flyout page in Android does not show flyout button (burger) consistently #24468

Open
guyvaio opened this issue Aug 27, 2024 · 2 comments
Open
Labels
area-navigation NavigationPage migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert platform/android 🤖 s/triaged Issue has been reviewed t/bug Something isn't working

Comments

@guyvaio
Copy link

guyvaio commented Aug 27, 2024

Description

The condition to show the flyout button (burger) or not is set in method ShouldShowToolbarButton of the FlyoutPage.
In Android, this method is not hit when orientation changes. This method is only called once during initialization.
Test is done with a physical Android tablet running MAUI 8.0.90-dev.

Under iOS, rotation of an iPad triggers correctly method ShouldShowToolbarButton.

The default code of ShouldShowToolbarButton of depends on the orientation. It’s inconsistent not to trigger this code after rotation.

public virtual bool ShouldShowToolbarButton()
{
	if (DeviceInfo.Idiom == DeviceIdiom.Phone)
		return true;

	FlyoutLayoutBehavior behavior = FlyoutLayoutBehavior;
	var orientation = DeviceDisplay.MainDisplayInfo.Orientation;

	bool isSplitOnLandscape = (behavior == FlyoutLayoutBehavior.SplitOnLandscape || behavior == FlyoutLayoutBehavior.Default) && orientation.IsLandscape();
	bool isSplitOnPortrait = behavior == FlyoutLayoutBehavior.SplitOnPortrait && orientation.IsPortrait();
	return behavior != FlyoutLayoutBehavior.Split && !isSplitOnLandscape && !isSplitOnPortrait;
}

Steps to Reproduce

  1. Create an MAUI app for MAUI 8.0
  2. For simplification purposes, set TargetFrameworks to net8.0-android only
  3. Set a FlyoutPage as the MainPage
  4. Set a simple ContentPage as Flyout of the MainPage
  5. Set a NavigationPage as Detail of the MainPage

Link to public reproduction project repository

No response

Version with bug

8.0.80 SR8

Is this a regression from previous behavior?

Yes, this used to work in Xamarin.Forms

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 12.0

Did you find any workaround?

Modification of source code in Maui-main\src\Controls\src\Core\NavigationPage\NavigationPageToolbar.cs

Relevant log output

No response

@guyvaio guyvaio added the t/bug Something isn't working label Aug 27, 2024
Copy link
Contributor

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

guyvaio added a commit to guyvaio/maui that referenced this issue Aug 27, 2024
The condition to show the flyout button (burger) or not is set in method ShouldShowToolbarButton of the FlyoutPage.
In Android, this method is not hit when orientation changes. This method is only called once during initialization.

This modification triggers the update of this button when orientation changes.

dotnet#24468
@samhouts samhouts added the migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert label Aug 27, 2024
@guyvaio
Copy link
Author

guyvaio commented Sep 6, 2024

Temporary fix https://gist.github.com/guyvaio/5ca11a6aa373c1fe486cc9e25137aeec
Hope this helps others.

@QianaJiao QianaJiao added the s/triaged Issue has been reviewed label Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-navigation NavigationPage migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert platform/android 🤖 s/triaged Issue has been reviewed t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants