workflow-kotlin
workflow-kotlin copied to clipboard
[kotlin] WorkflowViewStub breaks view back handling
If a LayoutRunner that is being used to render a view inside a WorkflowViewStub calls backPressedHandler = on the root view (the view passed to the LayoutRunner's constructor), that view is actually the parent view of the stub, so the back handler will be set on the stub's container. If another view doesn't replace the back handler in the stub's container, that handler will live beyond the lifetime of that screen.
To repro, see square/workflow#873.
I wonder if we should scrap backPressedHandler and instead provide the OnBackPressedDispatcher in ContainerHints. Be a lot less magical.
ModalViewContainer could just provide its own, a lot less crafty than what it's doing now.
Downside is we lose the nice property of tearing things down when the view is detached. If we go this route, should still provide some help for that.
the nice property of tearing things down when the view is detached
Seems like we don't always get this property anyway.
How do you figure?
Because that's what this issue is – the back handler isn't being torn down even after the "view" goes away.
Not API change, not 1.0 blocker. Might also make most UI stuff ExperimentalWorkflowApi.