unoplatform / uno

Build Mobile, Desktop and WebAssembly apps with C# and XAML. Today. Open source and professionally supported.
https://platform.uno
Apache License 2.0
8.78k stars 706 forks source link

[Android] `NavigationView` doesn't initially update Flyout position #18024

Open morning4coffe-dev opened 3 weeks ago

morning4coffe-dev commented 3 weeks ago

Current behavior

https://github.com/user-attachments/assets/d6a4865d-6dbf-4631-a16f-17437b4f4d47

Expected behavior

No response

How to reproduce it (as minimally and precisely as possible)

  <NavigationView PaneDisplayMode="LeftCompact">
    <NavigationView.MenuItems>
      <NavigationViewItem Content="Home" Icon="Home" Tag="Home" />
      <NavigationViewItem Content="Sub Menu 1" Icon="Keyboard" ToolTipService.ToolTip="Sub Menu 1">
        <NavigationViewItem.MenuItems>
          <NavigationViewItem Content="Notes" Icon="Page" ToolTipService.ToolTip="Notes"/>
          <NavigationViewItem Content="Mail" Icon="Mail" ToolTipService.ToolTip="Mail"/>
          <NavigationViewItem Content="Sub Menu 2" Icon="AllApps" ToolTipService.ToolTip="Sub Menu 2">
            <NavigationViewItem.MenuItems>
              <NavigationViewItem Content="Calendar" Icon="Calendar" ToolTipService.ToolTip="Calendar"/>
              <NavigationViewItem Content="Contacts" Icon="Contact" ToolTipService.ToolTip="Contacts"/>
            </NavigationViewItem.MenuItems>
          </NavigationViewItem>
        </NavigationViewItem.MenuItems>
        </NavigationViewItem.MenuItems>
      </NavigationViewItem>
    </NavigationView.MenuItems>
    <Frame x:Name="ContentFrame" />
  </NavigationView>

Workaround

No response

Works on UWP/WinUI

Yes

Environment

No response

NuGet package version(s)

No response

Affected platforms

Android, iOS?

IDE

Visual Studio 2022

IDE version

No response

Relevant plugins

No response

Anything else we need to know?

No response

morning4coffe-dev commented 3 weeks ago

After more investigation, actually the correct behavior seems to be that the Flyout shouldn't open at all at that point and the correct item should be selected.

cconner100 commented 3 weeks ago

So why is the Hamburger icon missing at the top left of the screen? This should open and close the menu but that option is not enabled

morning4coffe-dev commented 3 weeks ago

Thank you for the clarification, @cconner100. In the video I shared, there is a HotReload indicator that is covering the actual button. You can move it by dragging the two lines. Is that what you were referring to? 🤔

cconner100 commented 3 weeks ago

Yes can drag it but the hamburger menu is still not showing in my example

From: Dominik Titl @.> Date: Wednesday, August 28, 2024 at 6:35 PM To: unoplatform/uno @.> Cc: curtis conner @.>, Mention @.> Subject: Re: [unoplatform/uno] [Android] NavigationView doesn't initially update Flyout position (Issue #18024)

Thank you for the clarification, @cconner100https://github.com/cconner100. In the video I shared, there is a HotReload indicator that is covering the actual button. You can move it by dragging the two lines. Is that what you were referring to? 🤔

— Reply to this email directly, view it on GitHubhttps://github.com/unoplatform/uno/issues/18024#issuecomment-2315073641, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAHGD6PX2CJDIQ7BWG3XFXDZTWYYVAVCNFSM6AAAAABNEA4676VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMJVGA3TGNRUGE. You are receiving this because you were mentioned.Message ID: @.***>

Youssef1313 commented 3 weeks ago

@cconner100 Could you please post a screenshot after moving the HotReload indicator away?

cconner100 commented 3 weeks ago

I can move it and its still not showing but if I disable hot-reload from my source, the hamburger shows. Currently moving the hotReload sometimes works sometimes not. So for now the android works if I disable the hot reload

From: Youssef Victor @.> Date: Thursday, August 29, 2024 at 5:14 PM To: unoplatform/uno @.> Cc: curtis conner @.>, Mention @.> Subject: Re: [unoplatform/uno] [Android] NavigationView doesn't initially update Flyout position (Issue #18024)

@cconner100https://github.com/cconner100 Could you please post a screenshot after moving the HotReload indicator away?

— Reply to this email directly, view it on GitHubhttps://github.com/unoplatform/uno/issues/18024#issuecomment-2317239249, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAHGD6PEROJBWJGVMGYK5TDZT3X6XAVCNFSM6AAAAABNEA4676VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMJXGIZTSMRUHE. You are receiving this because you were mentioned.Message ID: @.***>

Youssef1313 commented 3 weeks ago

The flyout issue is a pointers issue where we get an extra incorrect Tapped event.

    <NavigationView x:Name="NavigationView" PaneDisplayMode="LeftCompact">
        <NavigationView.MenuItems>
            <NavigationViewItem Content="Sub Menu 1" Icon="Keyboard" ToolTipService.ToolTip="Sub Menu 1">
                <NavigationViewItem.MenuItems>
                    <NavigationViewItem Content="Notes" Icon="Page" ToolTipService.ToolTip="Notes"/>
                </NavigationViewItem.MenuItems>
            </NavigationViewItem>
        </NavigationView.MenuItems>
        <Frame x:Name="ContentFrame" />
    </NavigationView>

At the following state:

image

Clicking on "Notes" will first cause Tapped event on that NavigationViewItem, which will cause the pane to be closed. Then, we get another incorrect Tapped event on "Sub Menu 1" which will cause it to open as a flyout.