Fix OnNavigatedTo not called when navigating back to a specific page#25552
Fix OnNavigatedTo not called when navigating back to a specific page#25552PureWeen merged 11 commits intodotnet:mainfrom
Conversation
|
Hey there @devanathan-vaithiyanathan! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
/rebase |
bcd4333 to
90ce808
Compare
|
/azp run |
This comment was marked as outdated.
This comment was marked as outdated.
|
/rebase |
6f2b1b5 to
9997fc0
Compare
|
/azp run |
This comment was marked as off-topic.
This comment was marked as off-topic.
src/Controls/src/Core/Compatibility/Handlers/NavigationPage/iOS/NavigationRenderer.cs
Outdated
Show resolved
Hide resolved
|
Azure Pipelines successfully started running 3 pipeline(s). |
| if (_navigation.TryGetTarget(out navRenderer)) | ||
| { | ||
| if (!navRenderer._uiRequestedPop) | ||
| navRenderer._uiRequestedPop = true; |
There was a problem hiding this comment.
One thing I noticed is that this code is called if you just pop the page off the stack vs click the back button.
So, on the second page of this app if you add a button that calls "Navigation.popasync" this gets transitioned to true but then never transitions back to false.
if we change to instead use DidPopItem vs ShouldPopItem does that make this all work a bit better?
[Export("navigationBar:didPopItem:")]
[Internals.Preserve(Conditional = true)]
internal bool DidPopItem(UINavigationBar _, UINavigationItem __)
{
if (_ignorePopCall) return;
_uiRequestedPop = true;
return true;
}There was a problem hiding this comment.
Yea, I like the idea of just taking the test case.
Let's just get this PR merged with the test case since the other PR didn't have one
There was a problem hiding this comment.
@PureWeen, I have removed the fix. The PR now contains only the test case. Could you please review it?
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
Root Cause
When the back button is pressed and hold, and then released, the navigation pop action is not recognized as a user-initiated action.
Description of Change
To address an issue where the navigation pop action (when the back button is pressed and held, then released) was not being recognized as initiated by the user. Because the _uiRequestedPop field was not being set to true. The _uiRequestedPop field is used to recognize user tap actions on the back button. By setting _uiRequestedPop to true, the inner navigation actions are performed correctly, ensuring that the navigation pop action is recognized
Issues Fixed
Fixes #25371
Tested the behaviour in the following platforms
Output Screenshot
BeforeIssue.mp4
AfterIssue.mp4