-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Labels
area-navigationNavigationPageNavigationPagepartner/syncfusionIssues / PR's with Syncfusion collaborationIssues / PR's with Syncfusion collaborationplatform/androidplatform/ioss/triagedIssue has been reviewedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering TriageVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't workingSomething isn't working
Milestone
Description
Description
As per .NET MAUI 10, NavigatingFromEventArgs & NavigatedFromEventArgs now gives access to both DestinationPage and NavigationType.
OnNavigatedFrom behaves well, however OnNavigatingFrom will always fill current page as DestinationPage argument.
Example :
Using Shell, navigating From PageA to PageB :
02-16 12:20:07.669 I/DOTNET (15127): [PageA]::OnNavigatingFrom : Destination: 'PageA', NavigationType: 'PopToRoot'
02-16 12:20:08.039 I/DOTNET (15127): [PageA]::OnNavigatedFrom : Destination: 'PageB', NavigationType: 'PopToRoot'
02-16 12:20:08.047 I/DOTNET (15127): [PageB]::OnNavigatedTo : Previous: 'PageA', NavigationType: 'PopToRoot'PageB to PageA:
02-16 12:23:11.231 I/DOTNET (15127): [PageB]::OnNavigatingFrom : Destination: 'PageB', NavigationType: 'Push'
02-16 12:23:11.678 I/DOTNET (15127): [PageB]::OnNavigatedFrom : Destination: 'PageA', NavigationType: 'Push'
02-16 12:23:11.680 I/DOTNET (15127): [PageA]::OnNavigatedTo : Previous: 'PageB', NavigationType: 'Push'
Steps to Reproduce
- Create a new .NET MAUI App that uses Shell
- Register two page (Page A and Page B)
- Add logging on the pages :
protected override void OnNavigatingFrom(NavigatingFromEventArgs args)
{
Debug.WriteLine($"[{GetType().Name}]::OnNavigatingFrom : Destination: '{args.DestinationPage?.GetType().Name ?? "null"}', NavigationType: '{args.NavigationType}'");
}
protected override void OnNavigatedFrom(NavigatedFromEventArgs args)
{
Debug.WriteLine($"[{GetType().Name}]::OnNavigatedFrom : Destination: '{args.DestinationPage?.GetType().Name ?? "null"}', NavigationType: '{args.NavigationType}'");
}
protected override void OnNavigatedTo(NavigatedToEventArgs args)
{
Debug.WriteLine($"[{GetType().Name}]::OnNavigatedTo : Previous: '{args.PreviousPage?.GetType().Name ?? "null"}', NavigationType: '{args.NavigationType}'");
}- Navigate from PageA to PageB => logs should show OnNavigating DestinationPage == A while OnNavigated DestinationPage == B
- Navigate from PageB to PageA => logs should show OnNavigating DestinationPage == B while OnNavigated DestinationPage == A
Link to public reproduction project repository
No response
Version with bug
10.0.40
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
No response
Affected platforms
iOS, Android
Affected platform versions
No response
Did you find any workaround?
Use OnNavigated instead of OnNavigating but the lifecycle timings are not the same. OnNavigating is way more early in the navigation lifecycle, which is suitable for particular scenario.
Relevant log output
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-navigationNavigationPageNavigationPagepartner/syncfusionIssues / PR's with Syncfusion collaborationIssues / PR's with Syncfusion collaborationplatform/androidplatform/ioss/triagedIssue has been reviewedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering TriageVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't workingSomething isn't working