Frequently Asked Questions
ref
of the WebView
?
Can I get the 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} />;
}
WebViews
?
Can I Pass Custom Props to Yes. Read this guide: Native to Web Communication.
injectedJavaScript
Prop?
Will a Shell Pass Yes. WebshellComponent will pass any
injectedJavaScript
prop to the underlying WebView, along with scripts
bundled from features.
onMessage
Handler Prop?
Will a Shell Account for 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.
HandleOnLinkPressFeature
redundant with onNavigationStateChange
prop?
Isn't 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.