Konyaco
09/10/2020, 1:45 AMjava.lang.IllegalStateException: KeyEvent can't be processed because this key input node is not active.
when I press any key (including backpress, hardware keyboard keys). Do you have the same problem? How can I fix it? 🤔thanksAli Zargar Shabestari
09/10/2020, 5:21 AMKonyaco
09/10/2020, 5:30 AMclass CommunityActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
MyTheme {
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colors.background
) {
Community(onClose = ::close)
}
}
}
}
private fun close() {
finish()
}
}
@OptIn(ExperimentalKeyInput::class)
@Composable
fun Community(onClose: () -> Unit) {
val backgroundColor = MaterialTheme.colors.background
var loading by remember { mutableStateOf(true) }
Column(Modifier.fillMaxSize()) {
TopAppBar(title = {
Text("Title")
}, navigationIcon = {
IconButton(onClick = onClose) {
Icon(Icons.Filled.Close)
}
}, backgroundColor = MaterialTheme.colors.surface, actions = {
Crossfade(current = loading) {
if (it) CircularProgressIndicator()
}
})
AndroidView(
modifier = Modifier.fillMaxSize(),
viewBlock = {
WebView(it).apply {
settings.apply {
javaScriptEnabled = true
setSupportZoom(false)
javaScriptCanOpenWindowsAutomatically = true
domStorageEnabled = true
setBackgroundColor(backgroundColor.value.toInt())
}
webChromeClient = WebChromeClient()
webViewClient = object : WebViewClient() {
override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) {
loading = true
}
override fun onPageFinished(view: WebView?, url: String?) {
loading = false
}
}
loadUrl("<https://www.google.com>")
}
},
update = {}
)
}
}
Ali Zargar Shabestari
09/10/2020, 6:02 AMupdate = {}
. removing it solved the issue! don’t ask me why. I only replaced my code with yours and commented out the sections one by one :DKonyaco
09/10/2020, 11:03 AMNoOpUpdate
is just an alias of {}
. It seems to be caused by other factors.Madhava
09/28/2020, 6:15 AMKonyaco
09/28/2020, 8:16 AMMadhava
09/28/2020, 11:00 AMallan.conda
09/30/2020, 1:20 AM