-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix for Shell tab visibility not updating when navigating back multiple pages #34280
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
Closed
BagavathiPerumal
wants to merge
7
commits into
dotnet:inflight/current
from
BagavathiPerumal:fix-33351
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
943baa0
fix-33351-Made changes to trigger page appearing events before platfo…
BagavathiPerumal 847ddbe
fix-33351-Added iOS and Android snapshots.
BagavathiPerumal f1d5807
fix-33351-Modified the test script for windows platform.
BagavathiPerumal e8575b4
fix-33351-Changes committed and updated windows and mac snapshot.
BagavathiPerumal dcbeb7b
fix-33351-Changes Updated.
BagavathiPerumal 56df819
fix-33351-Modified the test script for windows platform.
BagavathiPerumal 262fab7
fix-33351-Changes committed and updated windows and mac snapshot.
BagavathiPerumal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+31 KB
...es.Android.Tests/snapshots/android/TabBarVisibilityAfterMultiLevelPopToRoot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
167 changes: 167 additions & 0 deletions
167
src/Controls/tests/TestCases.HostApp/Issues/Issue33351.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,167 @@ | ||
| namespace Maui.Controls.Sample.Issues; | ||
|
|
||
| [Issue(IssueTracker.Github, 33351, "Changing Shell Tab Visibility when navigating back multiple pages ignores Shell Tab Visibility", PlatformAffected.All)] | ||
| public class Issue33351 : Shell | ||
| { | ||
| public Issue33351() | ||
| { | ||
| Routing.RegisterRoute("Issue33351Page1", typeof(Issue33351Page1)); | ||
| Routing.RegisterRoute("Issue33351Page2", typeof(Issue33351Page2)); | ||
|
|
||
| var tabBar = new TabBar | ||
| { | ||
| Items = | ||
| { | ||
| new MyTab | ||
| { | ||
| Title = "Tab 1", | ||
| ContentTemplate = new DataTemplate(() => new Issue33351MainPage()) | ||
| }, | ||
| new ShellContent | ||
| { | ||
| Title = "Tab 2", | ||
| ContentTemplate = new DataTemplate(() => new Issue33351SecondTabPage()) | ||
| } | ||
| } | ||
| }; | ||
|
|
||
| Items.Add(tabBar); | ||
| } | ||
|
|
||
| class MyTab : ShellContent | ||
| { | ||
| protected override void OnAppearing() | ||
| { | ||
| base.OnAppearing(); | ||
|
|
||
| if (this.Parent != null) | ||
| Shell.SetTabBarIsVisible(this.Parent, true); | ||
|
|
||
| Shell.Current.Navigating -= OnShellNavigating; | ||
| Shell.Current.Navigating += OnShellNavigating; | ||
| } | ||
|
|
||
| protected override void OnDisappearing() | ||
| { | ||
| base.OnDisappearing(); | ||
|
|
||
| Shell.Current.Navigating -= OnShellNavigating; | ||
| } | ||
|
|
||
| void OnShellNavigating(object sender, ShellNavigatingEventArgs e) | ||
| { | ||
| if (this.Parent != null) | ||
| Shell.SetTabBarIsVisible(this.Parent, false); | ||
| } | ||
| } | ||
|
|
||
| class Issue33351MainPage : ContentPage | ||
| { | ||
| public Issue33351MainPage() | ||
| { | ||
| Title = "Main Page"; | ||
| AutomationId = "RootPage"; | ||
|
|
||
| var statusLabel = new Label | ||
| { | ||
| AutomationId = "TabBarVisibleLabel", | ||
| Text = "Tab Bar Visible" | ||
| }; | ||
|
|
||
| var navigateButton = new Button | ||
| { | ||
| AutomationId = "PushPage1Button", | ||
| Text = "Go to Page 1", | ||
| HorizontalOptions = LayoutOptions.Fill | ||
| }; | ||
|
|
||
| navigateButton.Clicked += async (s, e) => | ||
| { | ||
| await Shell.Current.GoToAsync("Issue33351Page1"); | ||
| }; | ||
|
|
||
| Content = new VerticalStackLayout | ||
| { | ||
| Padding = new Thickness(20), | ||
| Spacing = 20, | ||
| Children = { statusLabel, navigateButton } | ||
| }; | ||
| } | ||
| } | ||
|
|
||
| class Issue33351Page1 : ContentPage | ||
| { | ||
| public Issue33351Page1() | ||
| { | ||
| Title = "Page 1"; | ||
|
|
||
| var statusLabel = new Label | ||
| { | ||
| AutomationId = "TabBarHiddenLabel", | ||
| Text = "Tab Bar Hidden" | ||
| }; | ||
|
|
||
| var navigateButton = new Button | ||
| { | ||
| AutomationId = "PushPage2Button", | ||
| Text = "Go to Page 2", | ||
| HorizontalOptions = LayoutOptions.Fill | ||
| }; | ||
|
|
||
| navigateButton.Clicked += async (s, e) => | ||
| { | ||
| await Shell.Current.GoToAsync("Issue33351Page2"); | ||
| }; | ||
|
|
||
| Content = new VerticalStackLayout | ||
| { | ||
| Padding = new Thickness(20), | ||
| Spacing = 20, | ||
| Children = { statusLabel, navigateButton } | ||
| }; | ||
| } | ||
| } | ||
|
|
||
| class Issue33351Page2 : ContentPage | ||
| { | ||
| public Issue33351Page2() | ||
| { | ||
| Title = "Page 2"; | ||
| AutomationId = "Page2"; | ||
|
|
||
| var statusLabel = new Label | ||
| { | ||
| AutomationId = "TabBarHiddenLabel2", | ||
| Text = "Tab Bar Hidden" | ||
| }; | ||
|
|
||
| var popToRootButton = new Button | ||
| { | ||
| AutomationId = "PopToRootButton", | ||
| Text = "Go Back (../..)", | ||
| HorizontalOptions = LayoutOptions.Fill | ||
| }; | ||
|
|
||
| popToRootButton.Clicked += async (s, e) => | ||
| { | ||
| await Shell.Current.GoToAsync("../.."); | ||
| }; | ||
|
|
||
| Content = new VerticalStackLayout | ||
| { | ||
| Padding = new Thickness(20), | ||
| Spacing = 20, | ||
| Children = { statusLabel, popToRootButton } | ||
| }; | ||
| } | ||
| } | ||
|
|
||
| class Issue33351SecondTabPage : ContentPage | ||
| { | ||
| public Issue33351SecondTabPage() | ||
| { | ||
| Title = "Tab 2"; | ||
| Content = new Label { Text = "Tab 2" }; | ||
| } | ||
| } | ||
| } |
Binary file added
BIN
+10.8 KB
.../TestCases.Mac.Tests/snapshots/mac/TabBarVisibilityAfterMultiLevelPopToRoot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions
34
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue33351.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| using NUnit.Framework; | ||
| using UITest.Appium; | ||
| using UITest.Core; | ||
|
|
||
| namespace Microsoft.Maui.TestCases.Tests.Issues; | ||
|
|
||
| public class Issue33351 : _IssuesUITest | ||
| { | ||
| public Issue33351(TestDevice testDevice) : base(testDevice) | ||
| { | ||
| } | ||
|
|
||
| public override string Issue => "Changing Shell Tab Visibility when navigating back multiple pages ignores Shell Tab Visibility"; | ||
|
|
||
| [Test] | ||
| [Category(UITestCategories.Shell)] | ||
| public void TabBarVisibilityAfterMultiLevelPopToRoot() | ||
| { | ||
| App.WaitForElement("Tab 1"); | ||
| App.Tap("Tab 1"); | ||
|
|
||
| App.WaitForElement("PushPage1Button"); | ||
| App.Tap("PushPage1Button"); | ||
|
|
||
| App.WaitForElement("PushPage2Button"); | ||
| App.Tap("PushPage2Button"); | ||
|
|
||
| App.WaitForElement("PopToRootButton"); | ||
| App.Tap("PopToRootButton"); | ||
| App.WaitForElement("TabBarVisibleLabel"); | ||
|
|
||
| VerifyScreenshot(); | ||
| } | ||
| } |
Binary file added
BIN
+10.7 KB
...ases.WinUI.Tests/snapshots/windows/TabBarVisibilityAfterMultiLevelPopToRoot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+40.5 KB
...stCases.iOS.Tests/snapshots/ios-26/TabBarVisibilityAfterMultiLevelPopToRoot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+29.8 KB
.../TestCases.iOS.Tests/snapshots/ios/TabBarVisibilityAfterMultiLevelPopToRoot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.