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
22.22k stars 1.76k forks source link

OnNavigating wrong target when tapping the same tab #25599

Open lszl84 opened 1 week ago

lszl84 commented 1 week ago

Description

Let's say we have a tab bar with MainPage and SettingsPage. We are on MainPage and pushed DetailsPage on the navigation stack. We tap the MainPage tab again and we're back to MainPage from DetailsPage.

This is ok, but the problem is we don't get any indication of that in the AppShell's OnNavigating event, so we cannot prevent this with e.Cancel (e.g. when the user has some unsaved changes on the DetailsPage or something):

2024-10-30 12:44:17.996224+0100 BeginnersTask[50334:1782255] --- Navigating from //MainPage/DetailPage to //MainPage/DetailPage
2024-10-30 12:44:18.559204+0100 BeginnersTask[50334:1782255] --- Navigated from //MainPage/DetailPage to //MainPage

The Current and Target properties are the same in OnNavigating, but in OnNavigated the Previous and Current are different.

Code: TabBarNavigation from this repo: https://github.com/lszl84/maui-scroll-bug.git

Steps to Reproduce

  1. Tap Home
  2. Add a task
  3. Tap on the task - the details open
  4. Tap Home again - we are back home, but no indication of that in the OnNavigating event of the AppShell.

Link to public reproduction project repository

https://github.com/lszl84/maui-scroll-bug.git

Version with bug

8.0.82 SR8.2

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

No response

ninachen03 commented 1 week ago

This issue has been verified using Visual Studio 17.12.0 Preview 5(9.0.0-rc.2.24503.2 & 8.0.92 & 8.0.3). Can repro this issue at iOS platform.