@kthksgy/procedure-call-react-native-web-view
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

@kthksgy/procedure-call-react-native-web-view

This document is under construction.

Todos

  • Add tests
  • Write about how to call procedure

Installation

Run command below.

# npm
$ npm install @kthksgy/procedure-call @kthksgy/procedure-call-react-native-web-view

# yarn
$ yarn add @kthksgy/procedure-call @kthksgy/procedure-call-react-native-web-view

WebView guest usage

  1. Call startGuestHandler
  • This function creates entrypoint to window for communicating with WebView host.
startWebViewGuestHandler();

WebView host usage

  1. Create reference for WebView and assign
  2. Generate host listener and set as onMessage
  3. Optionally, console outputs inside WebView Guest can be bypassed by installing bypassConsole
const webViewReference = useRef<WebView>(null);

const listener = useMemo(function () {
  return generateWebViewHostListener(function () {
    return webViewReference.current;
  });
}, []);

return (
  <WebView
    injectedJavaScript={generateBypassConsoleInstaller() + 'true;'}
    onMessage={listener}
    ref={webViewReference}
  />
);

Package Sidebar

Install

npm i @kthksgy/procedure-call-react-native-web-view

Weekly Downloads

1

Version

0.0.1

License

MIT

Unpacked Size

36 kB

Total Files

16

Last publish

Collaborators

  • kthksgy