xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.63k stars 1.87k forks source link

[Bug] When a Shell Flyout item's "IsVisible" Property is changed at runtime on iOS only, we can not more do modal navigation #15008

Open DamienDoumer opened 2 years ago

DamienDoumer commented 2 years ago

Description

If you bind a Xamarin Shell Flyout Item's "IsVisible" property to a property in a ViewModel, then change the property's value from true to false at runtime, then try to navigate to a shell page with modal animation, the page never appears, though its life cycle events are called.

Steps to Reproduce

  1. bind the isvisible property of the shell's flyout item `

        <FlyoutItem Title="Browse" Icon="icon_feed.png"
            IsVisible="{Binding ShouldDisplayFlyoutItem}">
    
              <ShellContent Route="ItemsPage" ContentTemplate="{DataTemplate local:ItemsPage}"/>
    
       </FlyoutItem>

    `

  2. Change the value of this property from true to false a few seconds after app starts

`

    public void ChangeDisplayOption()
    {
        //Note: changing this value to false hides the "Browse" shell item. Thus caussing modal navigations to fail after this.
        //Note: if you comment this line, the bug disappears
        ShouldDisplayFlyoutItem = false;
    }

`

  1. Trigger navigation to a shell page with modal navigation

`

        OpenWebCommand = new Command(async () =>
        {
            //await Browser.OpenAsync("https://aka.ms/xamarin-quickstart");

            //Navigate to modal to reproduce the bug.
            await Shell.Current.GoToAsync(nameof(NewItemPage));
        });

`

  1. The page never appears

Here is the source code to reproduce this issue. ShellbugReproduction.zip

Expected Behavior

No matter what value the IsVisible Property of the flyout is bound to, we must be able to perform modal navigation anywhere in the app.

Actual Behavior

Modal navigation doesn't show up though life cycle events are called

Basic Information

Environment

Any VS2019 version

Reproduction Link

ShellbugReproduction.zip

Workaround

NONE

AndreKraemer commented 2 years ago

I have the same issue in one of our apps. Were you able to find a workaround @DamienDoumer?

DamienDoumer commented 2 years ago

Nope, what I did was just to change my approach. I moved the page that needed a specific condition to be displayed away frrom the flyout menu. I was stuck, and didn't have enough time to experiment

mmilkovski commented 2 years ago

I can confirm I have the same exact issue only on iOS, at runtime if you change "IsVisible" or "FlyoutItemIsVisible" it won't allow to open pages after that (I tried update with binding and code behind - same result)

abosquet commented 2 years ago

Same issue for me. Any plan to fix it in a soon release?

hugebug4ever commented 1 year ago

Same case here. Seems no progress on this issue, while the feature is crutial for a good app.

SliemBeji-FBC commented 1 year ago

This issue still presist aswell under Android!