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

Shell.Current.FlyoutIsPresented = true does not toggle the first time on Android #8226

Closed
SailDev opened this issue Jun 22, 2022 · 11 comments · Fixed by #19807
Closed

Shell.Current.FlyoutIsPresented = true does not toggle the first time on Android #8226

SailDev opened this issue Jun 22, 2022 · 11 comments · Fixed by #19807
Assignees
Labels
area-controls-shell Shell Navigation, Routes, Tabs, Flyout delighter fixed-in-8.0.7 fixed-in-9.0.100-preview.1.9973 p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint platform/android 🤖 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@SailDev
Copy link

SailDev commented Jun 22, 2022

Description

Shell.Current.FlyoutIsPresented inside a button click event handler toggles flyout only after flyout was manually swiped one time.

Steps to Reproduce

  1. Run the attached example.
  2. Tap on the "Toggle Flyout" button.
  3. Nothing happens.
  4. Swipe flyout manually.
  5. Tap on the "Toggle Flyout" button again.
  6. Now it works as expected.

Version with bug

6.0.400 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 11

Did you find any workaround?

No response

Relevant log output

No response

MauiApp7.zip

@SailDev SailDev added s/needs-verification Indicates that this issue needs initial verification before further triage will happen t/bug Something isn't working labels Jun 22, 2022
@JkPersson
Copy link

Also,
If you replace step 4 in the description above with navigating (GotoAsync in label TapGestureRecognizer command), the flyout will be shown instead of the navigated page.

@Eilon Eilon added the area-controls-shell Shell Navigation, Routes, Tabs, Flyout label Jun 22, 2022
@PureWeen PureWeen added platform/android 🤖 and removed s/needs-verification Indicates that this issue needs initial verification before further triage will happen labels Jun 22, 2022
@kristinx0211 kristinx0211 added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Jun 23, 2022
@kristinx0211
Copy link

verified repro on android with above project:
https://user-images.githubusercontent.com/99457000/175259094-e1134168-fb67-430d-88bc-777af0518e0f.mp4

@rachelkang rachelkang added this to the 6.0-servicing milestone Jun 27, 2022
@Redth Redth modified the milestones: 6.0-servicing, Backlog Aug 30, 2022
@ghost
Copy link

ghost commented Aug 30, 2022

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@theadin
Copy link

theadin commented Sep 12, 2022

Came across this issue too. It seems like a serious bug to me. I trust the team can fix it quickly :-)
Is there any workaround for this in the meantime?

@ViniciusAugustoRR
Copy link

has anyone found a workaround yet ?

@theadin
Copy link

theadin commented Nov 9, 2022

@ViniciusAugustoRR ,
Try adding these two lines before setting the FlyoutIsPresented to true:

Shell.Current.FlyoutBehavior = FlyoutBehavior.Locked;
Shell.Current.FlyoutBehavior = FlyoutBehavior.Flyout;
Shell.Current.FlyoutIsPresented = true;

@ViniciusAugustoRR
Copy link

@ViniciusAugustoRR , Try adding these two lines before setting the FlyoutIsPresented to true:

Shell.Current.FlyoutBehavior = FlyoutBehavior.Locked;
Shell.Current.FlyoutBehavior = FlyoutBehavior.Flyout;
Shell.Current.FlyoutIsPresented = true;

it worked, thanks a lot

@riccardominato
Copy link

riccardominato commented Dec 5, 2022

@ViniciusAugustoRR , Try adding these two lines before setting the FlyoutIsPresented to true:

Shell.Current.FlyoutBehavior = FlyoutBehavior.Locked;
Shell.Current.FlyoutBehavior = FlyoutBehavior.Flyout;
Shell.Current.FlyoutIsPresented = true;

That's very helpful, but I had to guarantee that those statements are executed exactly once.
Otherwise, the button only works the first time.

#if ANDROID
if (!_alreadyOpen)
{
    Shell.Current.FlyoutBehavior = FlyoutBehavior.Locked;
    Shell.Current.FlyoutBehavior = FlyoutBehavior.Flyout;
    _alreadyOpen = true;
}
#endif

Shell.Current.FlyoutIsPresented = !Shell.Current.FlyoutIsPresented;

Edit

I added #if ANDROID to my example, because doing this on iOS has an unexpected behavior.

@ViniciusAugustoRR
Copy link

@ViniciusAugustoRR , Try adding these two lines before setting the FlyoutIsPresented to true:

Shell.Current.FlyoutBehavior = FlyoutBehavior.Locked;
Shell.Current.FlyoutBehavior = FlyoutBehavior.Flyout;
Shell.Current.FlyoutIsPresented = true;

That's very helpful, but I had to guarantee that those statements are executed exactly once. Otherwise, the button only works the first time.

if (!_alreadyOpen)
{
    Shell.Current.FlyoutBehavior = FlyoutBehavior.Locked;
    Shell.Current.FlyoutBehavior = FlyoutBehavior.Flyout;
    _alreadyOpen = true;
}

Shell.Current.FlyoutIsPresented = !Shell.Current.FlyoutIsPresented;

I figured something similar to this, just less fancy lol (Used a counter instead of a bool :P), but thanks for the tip !

@samhouts samhouts removed s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Apr 5, 2023
@XamlTest XamlTest added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels May 17, 2023
@XamlTest
Copy link

XamlTest commented May 17, 2023

Verified this on Visual Studio Enterprise 17.7.0 Preview 1.0. Repro on Android 13.0 with below Project:
MauiApp7.zip

@stoff99
Copy link

stoff99 commented Aug 9, 2023

Still happen with newest .net8 preview ...

In my app i use an own action button placed in the top right of the navigation bar instead of the typical flyout burger menu in the top left.

This is my workaround for now:

`
#if ANDROID

        if (Shell.Current.FlyoutIsPresented)

        {
            Shell.Current.FlyoutBehavior = FlyoutBehavior.Disabled;
            Shell.Current.FlyoutIsPresented = false;
        }
        else
        {
            Shell.Current.FlyoutBehavior = FlyoutBehavior.Locked;
            Shell.Current.FlyoutIsPresented = true;

        }

#elif IOS

        Shell.Current.FlyoutIsPresented = !Shell.Current.FlyoutIsPresented;

#endif
`

@samhouts samhouts added delighter p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint labels Sep 13, 2023
@samhouts samhouts removed this from the Backlog milestone Oct 3, 2023
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 delighter fixed-in-8.0.7 fixed-in-9.0.100-preview.1.9973 p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint platform/android 🤖 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.