TWSView
TWSView is a composable function that renders a WebView within a specified context, allowing dynamic loading and interaction with web content. It provides various customizable options to handle loading states, error handling, and URL interception.
Parameters
The current TWSViewState representing the state of the WebView.
A Modifier to additionally customize the layout of the WebView.
The current TWSViewNavigator to control WebView navigation externally.
A custom composable displayed when there is an error loading content. Defaults to a SnippetErrorView with the same modifier as TWSView.
A custom composable displayed during loading. Defaults to a SnippetLoadingView with the same modifier as TWSView that is displayed until mainFrame content is loaded.
A TWSViewInterceptor invoked for URLs before navigation. Return true
to prevent navigation, false
to allow it.
The URL the app should redirect to after a Google login via Custom Tabs. Allows returning users to the app after authentication.
Enables pull-to-refresh action when set to true
.
Set to true to have this Composable capture back presses and navigate the WebView back.
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.
Users can customize the colors used in the pull-to-refresh SwipeRefreshLayout by overriding the following theme attributes in their app theme:
twsViewSwipeRefreshSpinnerColor
: The color of the spinner (progress indicator)twsViewSwipeRefreshBackgroundColor
: The background color behind the spinner
Example usage in the app theme:
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight">
<item name="twsViewSwipeRefreshSpinnerColor">#FF4081</item>
<item name="twsViewSwipeRefreshBackgroundColor">#EEEEEE</item>
</style>
TWSView is a composable function that renders a WebView within a specified context, allowing dynamic loading and interaction with web content. It provides various customizable options to handle loading states, error handling, and URL interception.
Parameters
A TWSSnippet containing the URL, custom HTTP headers, and modifiers for the web snippet to be rendered.
A Modifier to additionally customize the layout of the WebView.
A custom composable displayed when there is an error loading content. Defaults to a SnippetLoadingView with the same modifier as TWSView that is displayed until mainFrame content is loaded.
A custom composable displayed during loading. Defaults to a SnippetLoadingView with the same modifier as TWSView.
A TWSViewInterceptor invoked for URLs before navigation. Return true
to prevent navigation, false
to allow it.
The URL the app should redirect to after a Google login via Custom Tabs. Allows returning users to the app after authentication.
Enables pull-to-refresh functionality when set to true
.
Set to true to have this Composable capture back presses and navigate the WebView back.
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.
Users can customize the colors used in the pull-to-refresh SwipeRefreshLayout by overriding the following theme attributes in their app theme:
twsViewSwipeRefreshSpinnerColor
: The color of the spinner (progress indicator)twsViewSwipeRefreshBackgroundColor
: The background color behind the spinner
Example usage in the app theme:
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight">
<item name="twsViewSwipeRefreshSpinnerColor">#FF4081</item>
<item name="twsViewSwipeRefreshBackgroundColor">#EEEEEE</item>
</style>