WebView

fun WebView(state: WebViewState<WebView>, modifier: Modifier = Modifier, onCreated: (WebView) -> Unit = {}, onDispose: (WebView) -> Unit = {}, client: WebViewClient = remember { WebViewClient() }, chromeClient: WebChromeClient = remember { WebChromeClient() })

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

The WebView attempts to set the layoutParams based on the Compose modifier passed in. If it is incorrectly sizing, use the layoutParams composable function instead.

Parameters

state

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

modifier

A compose modifier

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.

onDispose

Called when the WebView is destroyed. Provides a bundle which can be saved if you need to save and restore state in this WebView.

client

Provides access to WebViewClient via subclassing

chromeClient

Provides access to WebChromeClient via subclassing


fun <T : WebView> WebView(state: WebViewState<T>, factory: (Context) -> T, modifier: Modifier = Modifier, onCreated: (T) -> Unit = {}, onDispose: (T) -> Unit = {}, client: WebViewClient = remember { WebViewClient() }, chromeClient: WebChromeClient = remember { WebChromeClient() })

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

The WebView attempts to set the layoutParams based on the Compose modifier passed in. If it is incorrectly sizing, use the layoutParams composable function instead.

Parameters

state

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

modifier

A compose modifier

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.

onDispose

Called when the WebView is destroyed. Provides a bundle which can be saved if you need to save and restore state in this WebView.

client

Provides access to WebViewClient via subclassing

chromeClient

Provides access to WebChromeClient via subclassing

factory

A WebView factory for using a custom subclass of WebView


fun <T : WebView> WebView(state: WebViewState<T>, factory: (Context) -> T, layoutParams: FrameLayout.LayoutParams, modifier: Modifier = Modifier, onCreated: (T) -> Unit = {}, onDispose: (T) -> Unit = {}, client: WebViewClient = remember { WebViewClient() }, chromeClient: WebChromeClient = remember { WebChromeClient() })

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

The WebView attempts to set the layoutParams based on the Compose modifier passed in. If it is incorrectly sizing, use the layoutParams composable function instead.

Parameters

state

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

layoutParams

A FrameLayout.LayoutParams object to custom size the underlying WebView.

modifier

A compose modifier

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.

onDispose

Called when the WebView is destroyed. Provides a bundle which can be saved if you need to save and restore state in this WebView.

client

Provides access to WebViewClient via subclassing

chromeClient

Provides access to WebChromeClient via subclassing

factory

A WebView factory for using a custom subclass of WebView