WebViewProps
Props of WebView: the page to load, where it may navigate, and its events.
Usage
Embed a hosted help page
This type is used by WebView
import { WebView } from 'kuito';
export default function Help() {
return <WebView flex={1} src="https://example.com/help" />;
}Type declaration
export type WebViewProps = {
/** The page to load. Set `src` or `html`, not both. */
src?: WebViewSource;
/** Inline HTML, resolved against `baseUrl` when given. */
html?: string | { html: string; baseUrl?: string };
/**
* Origins the WebView navigates to, as wildcard patterns (`https://*`).
* The main frame's navigations elsewhere open through Linking instead.
* `["http://*", "https://*"]` by default.
*/
allowedOrigins?: string[];
/** Runs in the main frame each time a document finishes loading. */
injectedJavaScript?: string;
/** True by default. */
javaScriptEnabled?: boolean;
/** iOS only: swipe from an edge to go back or forward. False by default. */
swipeNavigation?: boolean;
/** Replaces the platform's user agent. */
userAgent?: string;
onLoadStart?: (event: WebViewNavigationEvent) => void;
/** The page loaded. */
onLoad?: (event: WebViewNavigationEvent) => void;
/** The load ended, loaded or failed. */
onLoadEnd?: (event: WebViewNavigationEvent) => void;
onError?: (event: WebViewErrorEvent) => void;
/** The URL, title, loading state or history changed. */
onNavigate?: (event: WebViewNavigationEvent) => void;
onMessage?: (event: WebViewMessageEvent) => void;
};Members 13
| Name | Type | Required | Description |
|---|---|---|---|
src | WebViewSource | No | The page to load. Set src or html, not both. |
html | string | { html: string; baseUrl?: string;} | No | Inline HTML, resolved against baseUrl when given. |
allowedOrigins | string[] | No | Origins the WebView navigates to, as wildcard patterns (https://*).
The main frame's navigations elsewhere open through Linking instead.
["http://*", "https://*"] by default. |
injectedJavaScript | string | No | Runs in the main frame each time a document finishes loading. |
javaScriptEnabled | boolean | No | True by default. |
swipeNavigation | boolean | No | iOS only: swipe from an edge to go back or forward. False by default. |
userAgent | string | No | Replaces the platform's user agent. |
onLoadStart | (event: WebViewNavigationEvent) => void | No | — |
onLoad | (event: WebViewNavigationEvent) => void | No | The page loaded. |
onLoadEnd | (event: WebViewNavigationEvent) => void | No | The load ended, loaded or failed. |
onError | (event: WebViewErrorEvent) => void | No | — |
onNavigate | (event: WebViewNavigationEvent) => void | No | The URL, title, loading state or history changed. |
onMessage | (event: WebViewMessageEvent) => void | No | — |
onLoadStart — method signatures
Signatures
(event: WebViewNavigationEvent): voidParameters
| Name | Type | Required | Description |
|---|---|---|---|
event | WebViewNavigationEvent | Yes | — |
Returns
void
onLoad — method signatures
Signatures
(event: WebViewNavigationEvent): voidParameters
| Name | Type | Required | Description |
|---|---|---|---|
event | WebViewNavigationEvent | Yes | — |
Returns
void
onLoadEnd — method signatures
Signatures
(event: WebViewNavigationEvent): voidParameters
| Name | Type | Required | Description |
|---|---|---|---|
event | WebViewNavigationEvent | Yes | — |
Returns
void
onError — method signatures
Signatures
(event: WebViewErrorEvent): voidParameters
| Name | Type | Required | Description |
|---|---|---|---|
event | WebViewErrorEvent | Yes | — |
Returns
void
onNavigate — method signatures
Signatures
(event: WebViewNavigationEvent): voidParameters
| Name | Type | Required | Description |
|---|---|---|---|
event | WebViewNavigationEvent | Yes | — |
Returns
void
onMessage — method signatures
Signatures
(event: WebViewMessageEvent): voidParameters
| Name | Type | Required | Description |
|---|---|---|---|
event | WebViewMessageEvent | Yes | — |
Returns
void
Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.