maui icon indicating copy to clipboard operation
maui copied to clipboard

Flyout Button Disappears

Open AceCoderLaura opened this issue 4 months ago • 2 comments

Description

The flyout button disappears on iOS if you navigate backward to a new root page.

Basically, this will cause the flyout button to disappear:

_navigationPage.Navigation.InsertPageBefore(new ContentPage(), _currentRootPage);
await _navigationPage.Navigation.PopAsync();

Steps to Reproduce

  1. Checkout the public reproduction project repository below
  2. Open the MauiBugs.sln and run the FlyoutBug.csproj on iOS
  3. Click the "Demo Bug" button
  4. Observe that the flyout button is missing

Link to public reproduction project repository

https://github.com/AceCoderLaura/MauiBugs

Version with bug

8.0.10 SR3

Is this a regression from previous behavior?

Yes, this used to work in Xamarin.Forms

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS 15.8.2

Did you find any workaround?

Found one here: https://github.com/dotnet/maui/issues/21828#issuecomment-2055470982

Relevant log output

No response

AceCoderLaura avatar Apr 15 '24 05:04 AceCoderLaura

Found a workaround!

If you replace the flyout's icon with a new ImageSource after navigating back, it will re-render the button. I'm using a FileImageSource for my flyout's icon, so I can just reuse the File property and implicit conversion will create a new FileImageSource with the same icon.

Flyout.IconImageSource = ((FileImageSource)Flyout.IconImageSource).File;

AceCoderLaura avatar Apr 15 '24 06:04 AceCoderLaura

Verified on 8.0.20. Repro on iOS 17.2 and MacCatalyst, not repro on Windows 11 and Android 14.0-API34 with below Project: FlyoutBug.zip

XamlTest avatar Apr 16 '24 02:04 XamlTest