import React, {Component} from 'react'; import {View, Alert} from 'react-native'; import WebView from 'react-native-webview'; const HTML = `\n Messaging

`; type Props = {}; type State = {}; export default class Messaging extends Component { state = {}; constructor(props) { super(props); this.webView = React.createRef(); } render() { return ( {this.webView.current.postMessage('Hello from RN');}} automaticallyAdjustContentInsets={false} onMessage={(e: {nativeEvent: {data?: string}}) => { Alert.alert('Message received from JS: ', e.nativeEvent.data); }} /> ); } }