Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49083

Handling the Android back button

$
0
0

I’m struggling to understand how to use the Hardware Back button handlers in Ionic 5.

In my app I have the following structure:

Main Menu - List Component - Detail Component

If I navigate to the List Component and open up the Detail Component for item A, return to the list (via the Ionic back button), then do the same for Item B and then for Item C and so on. When I return to the List Component and I then hit the Android Hardware Back button I would like to always return to the Menu page immediately regardless if whether I have opened up any detail items or not but at the moment my app takes me back into every detail page I have opened previously and back to the list page again before finally returning to the menu at the end of that process.

What is the correct way of handling this and overriding that Back button press when in the List Component? Does a handler need to be added to that List Component that overrides the operation of the back button somehow and with a higher priority that the one I already have at the top level? And do I need to unsubscribe from it when the list component is destroyed?

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 49083

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>