-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Bug]Shell - OnBackButtonPressed not executing #7072
Comments
When overriding it in the |
I have the same problem with two XF apps. Thanks @jfversluis for the override hint. At least I am able to implement a workaround now. One show-stopper less. |
@MSiccDev could you maybe try to see if it still doesn't work in 4.2? Trying to reproduce this again with the latest code and I seem I am unable to. |
@jfversluis will do once it does not break the major parts of my apps. I have been hit with several bugs with 4.2 (non pre) and Shell on Android. |
Sorry to hear about that @MSiccDev ! Let me know as soon as you have found some time |
@jfversluis I tried it as soon as XF 4.2 is out still facing same issue onbackbutton is not executing. |
@XamDev-Anil not to say this shouldn't work but can you try using the BackButtonBehavior? It's a bit more integrated with Shell and we made a lot of upgrades to it with 4.2 |
@PureWeen Thanks for the suggestion , Most of my Application users are Android. Android users use hardware back button at most of times . So need to ensure some stuff are in right order before they go back and stop if not. |
A quick fix on this is much appreciated because this is stopping me from tasting shell :-( |
will do |
I am also experiencing this problem with Shell. I have a modal page that does fire OnBackButtonPressed() but it isn't called on any of my other pages. On a side note, I cannot see any option to hide the back button - I still want the nav bar so the title is displayed. Is it possible to also hide the button? Hope this incorrect behaviour is fixed soon. |
Shell BackButtonBehavior is good but in OnBackButtonPressed method we can return true which will not return us to previous page. It will be good to have bool property like ToReturn in this behavior. |
Hi All, I am experiencing the same problem on 4.3 OnBackButtonPressed does not get called but OnBackPressed gets called in the MainActivity I am calling the page as Shell.Current.GoToAsync("Test"); The navigation back button works perfectly it is only the hardware back button which does not work. Has anyone found a solution to this problem ? |
Hello All, I am experiencing the same issue on XF 4.3.0 Shell, OnBackButtonPressed() does not fire for Android hardware back button, any workaround or fix? the client is breathing down my neck, I have to stop the app going back when the popup modal is displayed, what can I do? |
@Dintwe I know this is not ideal but my workaround was by using messaging center from the main activity
Then subscribing to it in the form |
Thank you @qz2rg4 for the prompt response I really appreciate it, thank you very much. One workaround I concocted is to have a flag accessible through singleton.
I can set then access it in
|
Is this issue getting any love / attention? (yes, I can apply a hack but that's not my style) |
@mjfreelancing we will definitely get around to it at some point. If you are dependant on it to be fixed soon for the time being you might want to do with a workaround, or if you're up for it, open a PR to fix it so everyone can benefit from it :) Thanks! |
The problem with this issue is that the workaround I need for #8581 is using exactly that :( |
@jfversluis I'd love to open a PR, except I don't know where to start. I did take a cursor look several weeks ago and while I could kind-of see why it wasn't working I haven't got a clue about the most appropriate fix. If I get time to take another look I'll reach out to someone for guidance. |
A quick workaround I've found is to add this snippet to the AppShell.cs of your project
This should wire it back to the button of whatever page is being displayed. Of course, if the back button of that page returns false, it'll proceed as normally. I'll bring a note here if any side effects happen on my app. |
@RaelsonCraftz, thank you your workaround. It works well. |
@PureWeen OnBackButtonPressed is called in latest XF version, but even when returning true it still does the default behaviour (pops the page). That doesn't happen with @RaelsonCraftz workaround. |
@PureWeen I'm having the same experience as @domagojmedo - OnBackButtonPressed is called, however if I return true the event still propagates. I want to handle and consume hardware back button presses. Any ideas? |
Well this is embarrassing |
* Invert logic for SendBackButtonPressed on Shell * - additional test fixes #7072
Description
When navigating back to previous page using hardware back button OnBackButtonPressed is not fired or executed.
Steps to Reproduce
Navigate to a page.
Click hardware back button
Expected Behavior
OnBackButtonPressed should be called
Actual Behavior
OnBackButtonPressed is not called
Basic Information
Version with issue: 4.1
Platform Target Frameworks:
Android: 9
Affected Devices: All Android Devices and Emulators
The text was updated successfully, but these errors were encountered: