How to handle WebView back press event? `WebComp...
# compose
k
How to handle WebView back press event?
Copy code
WebComponent(
    url = url.value,
    webContext = webContext,
    modifier = Modifier.keyInputFilter {
        if (it.key == Key.Back) {
            if (webContext.canGoBack()) {
                webContext.goBack()
                true
            } else false
        } else false
    },
)
But I got exceptions
Copy code
Exception dispatching finished signal.
Exception in MessageQueue callback: handleReceiveCallback
java.lang.IllegalStateException: KeyEvent can't be processed because this key input node is not active.
g
I handle back press event by overriding
Activity.onBackPressed
and then pass this event to my
ViewModel
, like JetNews does
k
Didn't work. I have had this problem since 1.0.0-alpha01 or maybe later.
g
@Kyant Sorry, what I need to import to use
WebComponent
, I want to try it
a
the exception here looks like a bug in compose ui, please file it with a repro if you are able
­čĹŹ 1