Skip to content

How to specify the order of back press handlers? #36

Answered by arkivanov
evjava asked this question in Q&A
Discussion options

You must be logged in to vote

Hello and thanks for the question!

As I see, the order isn't specified

The BackPresessedHandler is part of the Essenty library. And the order is specified in the README file. All registered callbacks are called in reverse order. This reflects the behaviour of the the AndroidX OnBackPressedDispatcher.

I can implement all these handlers, but I don't understand, how to tangle them together in correct order.

Based on what you described, I suggest the following implementation. First, you can avoid passing the handleBackButton flag to the ComponentContext.router(...) method. This will allow manual back button handling. Next, perhaps you can register just one callback to the BackButtonHandler

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@arkivanov
Comment options

@evjava
Comment options

Answer selected by evjava
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #35 on February 12, 2022 17:32.