-
-
Notifications
You must be signed in to change notification settings - Fork 81
Open
Description
Hi,
I encountered this Exception while trying to set properties to the WebView:
Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException: Not on FX application thread; currentThread = AWT-EventQueue-0
at javafx.graphics/com.sun.javafx.tk.Toolkit.checkFxUserThread(Toolkit.java:294)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.checkFxUserThread(QuantumToolkit.java:481)
at javafx.web/javafx.scene.web.WebEngine.checkThread(WebEngine.java:1220)
at javafx.web/javafx.scene.web.WebEngine$1.invalidated(WebEngine.java:486)
at javafx.base/javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:110)
at javafx.base/javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:145)
at javafx.web/javafx.scene.web.WebEngine.setJavaScriptEnabled(WebEngine.java:475)
at com.mohamedrejeb.calf.ui.web.WebView_desktopKt.applySettings(WebView.desktop.kt:173)
We use the WebView like this in commonMain code:
val webViewState = rememberWebViewState(url)
LaunchedEffect(Unit) {
webViewState.settings.javaScriptEnabled = true
webViewState.settings.androidSettings.supportZoom = true
}
WebView(
state = webViewState,
modifier = Modifier.fillMaxSize()
)
What is the correct way to configure the WebView?
I assume that Platform.runLater() needs to be used, but I can't to that from commonMain.
What can I do to avoid this issue?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels