Frequently Asked Questions

Can I get the ref of the WebView?

Yes. Webshell component already forwards the reference of the underlying WebView. Just use ref prop as you would with a WebView!

function MyComponent() {
const webViewRef = useRef(null);
return <Webshell ref={webViewRef} />;
}

Can I set Feature Options Dynamically?

Yes. React.useMemo is your friend:

function MyComponent({ option, ...props }) {
const Webshell = React.useMemo(() =>
makeWebshell(WebView, new Feature({ dynamicOption: option })),
[option]
);
return <Webshell {...props} />;
}

Can I Pass Custom Props to WebViews?

Yes. Read this guide: Native to Web Communication.

Will a Shell Pass injectedJavaScript Prop?

Yes. WebshellComponent will pass any injectedJavaScript prop to the underlying WebView, along with scripts bundled from features.

Will a Shell Account for onMessage Handler Prop?

Yes. It will intercept specific events created by features, and hoist any message which doesn't comply to very specific requirements towards the controlling component.

Isn't HandleOnLinkPressFeature redundant with onNavigationStateChange prop?

Somehow. But HandleOnLinkPressFeature is more reliable. On Android, calling webView.stopLoading() will disable further taps from the same page, leading to a lot of undesired behaviors.

Last updated on by Jules Sam. Randolph