dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
21.98k stars 1.72k forks source link

Shell Tab is still visible after set Tab.IsVisible to false #8788

Open SamShanWang opened 2 years ago

SamShanWang commented 2 years ago

Description

In the beginning, there is one tab visible ( tab 1 ) and two tabs hidden ( tab 2 and tab 3 ) on a TabBar. Then I want to display tab 2 and tab 3. Meanwhile, hide tab 1.

  1. Here is the code to do it.

Tab2.IsVisible = true; Tab3.IsVisible = true; Tab1.IsVisible = false;

Run in Android platform, the result is: image If you tap 'Tab 3' tab header, the app will crash.

When run in Windows platform, the result is correct.

  1. If I use the code below.

Tab1.IsVisible = false; Tab2.IsVisible = true; Tab3.IsVisible = true;

Then run in Android platform, the result is correct. image

But run in Windows platform, the app will crash.

A repro project is provided: https://github.com/SamShanWang/maui-shell-tab-hide-bug.git

Steps to Reproduce

  1. Load repro project in VS and run on Android platform.
  2. Click the menu item 'Tap me to reproduce bug on android' on flyout.
  3. Notice the view of TabBar.
  4. Tap 'Tab 3' tab header, the app crashes.
  5. Then run on Windows platform.
  6. Click the menu item 'Tap me to reproduce bug on windows' on flyout. Then the app crashes.

Version with bug

9.0.408 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android, Windows, I was not able test on other platforms

Affected platform versions

Android 7.1, Android 9.0, Windows 10 version 19044.1826, I was not able test on other platform versions

Did you find any workaround?

No response

Relevant log output

No response

rmarinho commented 2 years ago

On Windows and iOS seems to work fine, but on Android i can reproduce the crash.

SamShanWang commented 2 years ago

@rmarinho It doesn't work fine on Windows.

  1. Please pull the newest repro project.
  2. Then run on Windows platform.
  3. Click the menu item 'Tap me to reproduce bug on windows' on flyout. Then the app crashes.
shawyunz commented 1 year ago

After encountering the same issue, I ran a series of tests and found that the problem only occurs when the "IsVisible" property is bound to the first tab.

XamlTest commented 1 year ago

Verified this on Visual Studio Enterprise 17.7.0 Preview 1.0. This issue can be reproduced on Windows 11 and Android 13.0 with below project: MauiAppShellTabHideBug.zip

Windows11: App crash after clicking 'Tap me to reproduce bug on windows' on flyout. image

Android: App crash after clicking 'Tap me to reproduce bug on android' on flyout -> Tap 3. image

CusYaBasic commented 10 months ago

Any update on this? I appear to be having a similar issue, however it's android crashing and not windows

vibollee commented 4 months ago

any update on this? im having the same issue. Simple navigation issue shouldnt take this long to fix.