-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[.Net10][Proposal]TabbedPage - TabActiveTapped event #30445
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
base: net10.0
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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 to TabbedPage
so that taps on the currently active tab can be handled consistently across platforms.
- Adds the
TabReselected
event and anOnTabReselected
invoker in the sharedTabbedPage
class. - Hooks into Android’s
TabbedPageManager
and iOS’s compatibilityTabbedRenderer
to raise the event on reselection. - Updates
PublicAPI.Unshipped.txt
for all frameworks to expose the new event.
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
src/Controls/src/Core/TabbedPage/TabbedPage.cs | Added TabReselected event and OnTabReselected method |
src/Controls/src/Core/Platform/Android/TabbedPageManager.cs | Invoke OnTabReselected on bottom‐nav and tab reselection |
src/Controls/src/Core/Compatibility/Handlers/TabbedPage/iOS/TabbedRenderer.cs | Override ViewDidLoad to wire up tab reselection callback |
src/Controls/src/Core/PublicAPI/**/PublicAPI.Unshipped.txt | Expose TabbedPage.TabReselected in public API for each TF |
Comments suppressed due to low confidence (3)
src/Controls/src/Core/TabbedPage/TabbedPage.cs:62
- Missing XML documentation for the
TabReselected
event; please add a<summary>
explaining its purpose.
public event EventHandler TabReselected;
src/Controls/src/Core/TabbedPage/TabbedPage.cs:62
- No tests were added for
TabReselected
; please add UI tests in TestCases.HostApp and corresponding NUnit tests in TestCases.Shared.Tests to validate the event is raised.
public event EventHandler TabReselected;
src/Controls/src/Core/Platform/Android/TabbedPageManager.cs:968
- [nitpick] The field
_initialBottomNavigation
is a bit ambiguous; consider renaming to_hasInitialNavigationSelection
or_isFirstNavigationTap
for clarity.
bool _initialBottomNavigation;
c9b235f
to
8753ed8
Compare
src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Unshipped.txt
Outdated
Show resolved
Hide resolved
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
base.ViewDidLoad(); | ||
ShouldSelectViewController = (tabController, viewController) => | ||
{ | ||
if (viewController == tabController.SelectedViewController) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (viewController == tabController.SelectedViewController) | |
if (viewController is tabController.SelectedViewController) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I m confused this is ShouldSelectViewController
and we use that to send an event that we activated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, because it always returns true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We normally don t add public api to service release.
Can we make that internal for now?
Also we might need to add some comments to better understand why we have the state _initialBottomNavigation
@rmarinho sorry my bad... this PR should be targeted to net10 only Also I've added such comment // The _initialBottomNavigation flag prevents TabActiveTapped from firing during initial setup.
// We only want this event when users actually tap an already-selected tab, not during framework initialization. |
629fe75
to
2c913e9
Compare
Description of Change
This proposal introduces a new TabReselected event to the .NET MAUI TabbedPage. This event is raised when a user taps on the currently active tab. It provides developers with a clean and consistent way to handle tab reselection scenarios across platforms.
Motivation
In many tab-based applications, it's a common user expectation that tapping an already selected tab performs an action, such as popping the navigation stack to the root or refreshing the content. Currently, developers must implement workarounds to detect tab reselection, which adds complexity and platform-specific code.
Fixes #27401
Fixes #15301
Fixes #29395