Function: makeWebshell

â–¸ makeWebshell<C, F>(WebView: C, ...features: F): WebshellComponent<C, F>

Creates a React component which decorates WebView component with additional capabilities such as:

  • handling messages from the Web environment;
  • sending messages to the Web environment, see WebHandle;
  • running script in the Web environment.

example

import {
makeWebshell,
HandleHashChangeFeature,
HandleVisualViewportFeature
} from '@formidable-webview/webshell';
const features = [
new HandleHashChangeFeature(),
new HandleVisualViewportFeature()
]
const Webshell = makeWebshell(
WebView,
...features
);

Type parameters:

NameTypeDescription
CComponentType<any>The type of the WebView component.
FFeature<{}, {}, {}>[]The type for a collection of features to inject.

Parameters:

NameTypeDescription
WebViewCA WebView component, typically exported from react-native-webview.
...featuresFFeatures to inject in the WebView.

Returns: WebshellComponent<C, F>