Skip to content

Conversation

KarthikRajaKalaimani
Copy link
Contributor

@KarthikRajaKalaimani KarthikRajaKalaimani commented Oct 9, 2025

Issue Details:

On Android, the OnNavigatedTo method of the content page is being called twice when Detail page of FlyoutPage is navigation page.

Root Cause:

The duplicate invocation occurs due to two separate triggers:

i) Setting the Detail property of the FlyoutPage explicitly calls OnNavigatedTo.
ii) The OnHandlerChangedCore method also triggers OnNavigatedTo. This method is invoked from the overridden OnFragmentResumed in StackNavigationManager, which is itself called from the native Android framework during the fragment lifecycle.

As a result, both the framework-level and platform-level calls cause OnNavigatedTo to execute, leading to the observed duplication.

Description of Change:

To prevent duplicate calls, the OnNavigatedTo method is not invoked again if the same page has already been navigated to. This check is handled within the SendNavigatedTo method of the Page class.

Tested the behavior in the following platforms.

  • Android
  • Windows
  • iOS
  • Mac

Reference:

N/A

Issues Fixed:

Fixes #23902

Screenshots

Before After
Screen.Recording.2025-10-09.at.11.25.36.AM.mov
Screen.Recording.2025-10-09.at.11.22.43.AM.mov

@dotnet-policy-service dotnet-policy-service bot added community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration labels Oct 9, 2025
@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

{
App.WaitForElement("Go to Third Page");
App.Tap("ThirdPageButton");
await Task.Delay(300);
Copy link
Contributor

Choose a reason for hiding this comment

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

Include a comment explaining it, waiting to navigation animations to complete.


internal void SendNavigatedTo(NavigatedToEventArgs args)
{
if (HasNavigatedTo)
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this blocks OnNavigatedTo after the first call, even when navigating away and back to the page? (NavigationPage, TabbedPage, FlyoutPage).


[Test]
[Category(UITestCategories.Navigation)]
public async Task Issue23902NavigationTest()
Copy link
Contributor

Choose a reason for hiding this comment

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

Can include more tests?
I would like to verify Re-Navigation cases:

  • OnNavigatedToCalledAgainOnReNavigation. Navigate to PageA, navigate back, then navigate to PageA again. OnNavigatedTo should be called twice (once per navigation TO the page). Expected: NavigatedTo count = 2
  • OnNavigatedToCalledAgainOnReFlyoutNavigation. Same using a FluyoutPage.


internal void SendNavigatedTo(NavigatedToEventArgs args)
{
if (HasNavigatedTo)
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this blocks OnNavigatedTo after the first call, even when navigating away and back to the page? (NavigationPage, TabbedPage, FlyoutPage).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-controls-flyoutpage FlyoutPage area-navigation NavigationPage community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NavigationPage and FlyoutPage both call OnNavigatedTo, so it is called twice

2 participants