React Native WebView Invoke onMessage

source={{ uri: url1 }}
style={{ flex: 1 }}

url1 will redirect to url2 after completing a payment. The question is how can invoke onMessage in url2? I tried window.postMessage in url2, but that did not invoke the Webview onMessage that is on the client-side. What am I missing here?

The html in my url2 is like following:

<DOCTYPE html>
      <button id="event">Go Back</button>
    document.getElementById('event').addEventListener('click', function() {
      window.postMessage('string', '*')}, false);