Android back button should actually go back
complete
This post was marked as
complete
This post was marked as
in progress
This post was marked as
planned
This post was marked as
in progress
rreusser
All good. Yeah, it was basically just that BackAndroid exposes the raw event but doesn't facilitate any meaningful back management. To prevent the app from exiting, it's basically just a one-liner to hook up a hardwareBack handler that returns true, but meaningfully managing state didn't turn out to be so simple. As far as I know, idiomatic Android apps contain many Activities, so the back button pretty much just works. RN apps manage a single Activity though, so it's left to the developer to wrangle back into something meaningful.
My solution was to create a
<BackAndroidHandler onBack={...}>
component that manages a listener stack and implements propagation in the order of mounting. It's simple to use but not elegant.The forthcoming NavigationExperimental (https://github.com/ericvicenti/navigation-rfc) appears to attempt to address this in a more coherent way though, so maybe the solution is to look toward the future. 😄
Dan Leveille
rreusser Haha, np. Dododex is actually built in React Native. Didn't see your original comment though!
rreusser
Oops. Forgive my previous comment that was about React Native, not dododex—although if dododex is written in React Native, I have to wonder if my comment may actually have addressed the issue :)