Skip to content

[.Net10][Proposal]Shell - TabActiveTapped event #30446

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

kubaflo
Copy link
Contributor

@kubaflo kubaflo commented Jul 5, 2025

Description of Change
This proposal introduces a new TabReselected event for tabs within .NET MAUI Shell. This event is triggered when the user taps on the currently active tab in the bottom tab bar. It provides a consistent and straightforward way for developers to respond to tab reselection scenarios within Shell-based applications.

Motivation
In many modern mobile applications that utilize tab-based navigation, it's a common user expectation that tapping the already active tab performs an action, such as resetting the navigation stack or refreshing the content. Currently, implementing this behavior within .NET MAUI Shell requires manual workarounds and platform-specific logic.

Fixes #27401
Fixes #15301
Fixes #29395

@Copilot Copilot AI review requested due to automatic review settings July 5, 2025 17:41
@kubaflo kubaflo requested a review from a team as a code owner July 5, 2025 17:41
@kubaflo kubaflo requested review from mattleibow and rmarinho July 5, 2025 17:41
@kubaflo kubaflo self-assigned this Jul 5, 2025
@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Jul 5, 2025
Copy link
Contributor

Hey there @@kubaflo! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new TabReselected event in .NET MAUI Shell to let developers react when the active tab is tapped again. It adds internal plumbing, updates platform handlers, and records the new event in the public API unshipped files.

  • Adds SendTabReselected methods in ShellSection and Shell
  • Defines a public TabReselected event in Shell
  • Updates iOS and Android renderers to trigger the new event
  • Records the new event in all PublicAPI.Unshipped.txt files

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/Controls/src/Core/Shell/ShellSection.cs Added SendTabReselected to propagate reselection
src/Controls/src/Core/Shell/Shell.cs Declares public TabReselected event and its invoker
src/Controls/src/Core/PublicAPI/*/PublicAPI.Unshipped.txt Records the new public API entry for TabReselected
src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellItemRenderer.cs Triggers SendTabReselected when the selected VC is tapped again
src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellItemRenderer.cs Implements reselection logic with _initialTabNavigation flag
Comments suppressed due to low confidence (1)

src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellItemRenderer.cs:65

  • [nitpick] The field '_initialTabNavigation' is ambiguous; consider renaming it to something like '_hasHandledInitialNavigation' or '_isFirstTabSelection' for clarity.
		bool _initialTabNavigation;

@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

Copy link
Contributor

@jsuarezruiz jsuarezruiz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you create a related test?

@@ -1289,7 +1289,7 @@ public ScrollMode FlyoutVerticalScrollMode

public event EventHandler<ShellNavigatedEventArgs> Navigated;
public event EventHandler<ShellNavigatingEventArgs> Navigating;

public event EventHandler TabReselected;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could add a custom EventArgs with some parameters like the shell section etc

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can, but what should they include?

@kubaflo kubaflo changed the title [.Net10][Proposal]Shell - TabReselected event [.Net10][Proposal]Shell - TabActiveTapped event Jul 7, 2025
@kubaflo kubaflo added the community ✨ Community Contribution label Jul 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants