Hi, I made a copy of the <ChildPanelsFactory.kt> a...
# decompose
c
Hi, I made a copy of the ChildPanelsFactory.kt and added a new parameter to
childPanels()
called
backHandler
. As the name suggested, it allows the user to provide a customized back handler, and one of the handlers I provided is that in a
MultiModeChildPanelsBackHandler
where in triple mode, pressing back goes to dual mode, and dual to single. https://gist.github.com/CXwudi/03c5c7fae17518912b305f4e4b0423ea Let me know what do you thought
a
Perhaps, you could still use the default implementation. And in your component you can register a BackCallback that changes the panels mode. You need to observe the ChildPanels state and enable/disable the callback accordingly.
c
Ahhh, I need to manually enable/disabled callback accordingly based on the state. That's why i see that when using the BackCallback, it always prevent the parent back button handling
👍 1
a
Yeah, the API is similar to Jetpack OnBackPressedDispatcher.