Dark theme of webview doesn't work in AndroidView Jetpack compose.
RichEditor extend webview.
No errors. Simply can't apply dark theme to view
implementation 'jp.wasabeef:richeditor-android:2.0.0'
@Composable
fun Webview{
AndroidView(
factory = { context ->
RichEditor(context).apply {
setEditorHeight(40)
setPadding(10, 10, 10, 10)
loadCSS("file:///android_asset/style.css")
if (isFeatureSupported(WebViewFeature.ALGORITHMIC_DARKENING)) {
WebSettingsCompat.setAlgorithmicDarkeningAllowed(settings, true)
}
setOnTextChangeListener {
scope.launch {
}
}
}
},
update = {
},
)
}
It's not working because simply
RichEditor(orWebView) does not support dark mode by itself. You can use public functions to adjust it's look based on dark theme: