// Web App
<button onClick={() => {
if(window.ReactNativeWebView) { // ensure window.ReactNativeWebView is there, otherwise, web app might crash if is not there
window.ReactNativeWebView.postMessage('Wayne is coming again')
}
}}>
</button>
// Native App
<WebView
onMessage={(event) => {
console.log(event.nativeEvent.data) // Client received data
}}
source={{ uri: 'https://your.domain.com' }}
/>
// Native
this.webviewRef.postMessage('Wayne is coming!!!')
// Web
window.addEventListener("message", message => {
console.log(message.data) // Wayne is coming!!!
});