WebView

@Composable()
fun WebView(state: WebViewState, modifier: Modifier = Modifier, captureBackPresses: Boolean = true, navigator: WebViewNavigator = rememberWebViewNavigator(), onCreated: (WebView) -> Unit = {}, onDispose: (WebView) -> Unit = {}, client: AccompanistWebViewClient = remember { AccompanistWebViewClient() }, chromeClient: AccompanistWebChromeClient = remember { AccompanistWebChromeClient() }, factory: (Context) -> WebView? = null)

A wrapper around the Android View WebView to provide a basic WebView composable.

If you require more customisation you are most likely better rolling your own and using this wrapper as an example.

Samples

com.google.accompanist.sample.webview.BasicWebViewSample

Parameters

state

The webview state holder where the Uri to load is defined.

captureBackPresses

Set to true to have this Composable capture back presses and navigate the WebView back.

navigator

An optional navigator object that can be used to control the WebView's navigation from outside the composable.

onCreated

Called when the WebView is first created, this can be used to set additional settings on the WebView. WebChromeClient and WebViewClient should not be set here as they will be subsequently overwritten after this lambda is called.

client

Provides access to WebViewClient via subclassing

chromeClient

Provides access to WebChromeClient via subclassing

factory

An optional WebView factory for using a custom subclass of WebView