Skip to content
Discussion options

You must be logged in to vote

Now I wonder why?

That's because the root ComponentContext being created as DefaultComponentContext(lifecycle = lifecycle) is disconnected from the Activity's OnBackPressedDispatcher, meaning the Activity is not aware of its internal back stack and just closes when the back is pressed.

The defaultComponentContext() is an extension function that automatically connects Lifecycle, StateKeeper, InstanceKeeper and BackHandler to the hosting Activity. Without it you'd need to manually drive the lifecycle, plus state preservation, instance retaining and back handling won't work.

as on the desktop DefaultComponentContext works just fine (with custom handler for "back navigation" mapped to [esc]).

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@woj-tek
Comment options

@arkivanov
Comment options

@woj-tek
Comment options

@arkivanov
Comment options

Answer selected by woj-tek
@woj-tek
Comment options

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