Skip to content

KevinnZou/compose-webview-accompanist

 
 

Repository files navigation

WebView wrapper for Jetpack Compose

Note This library has been migrated to compose-webview to independent from the accompanist library.

Maven Central badge-android

According to the official documentation updated on August 2023, Jetpack Compose Accompanist library decided to deprecate the Web library with no replacement. However, as a contributor to this library, I am still relying on it to provide WebView support in my App. Thus, I decided to fork that library and make future updates on it. This is a fork of the original library with the latest version 0.33.1-alpha.

For more information, visit the documentation: https://google.github.io/accompanist/web/

Basic Usage

To implement this wrapper there are two key APIs which are needed: WebView, which provides the layout, and rememberWebViewState(url) which provides some remembered state including the URL to display.

The basic usage is as follows:

val state = rememberWebViewState("https://example.com")

WebView(state)

This will display a WebView in your Compose layout that shows the URL provided.

Download

Maven Central

repositories {
    mavenCentral()
}

dependencies {
    implementation "io.github.KevinnZou:compose-webview:0.33.3"
}

License

Compose WebView is distributed under the terms of the Apache License (Version 2.0). See the license for more information.