-
-
Save winadiw/c80fac5ddd7d7090a162abb12c273bae to your computer and use it in GitHub Desktop.
Sending Data from WebView To React Native
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //This sends data from WebView to React Native | |
| ... | |
| <script> | |
| window.postMessage("Sending data from WebView"); | |
| </script> | |
| ... | |
| //In order to get data the was sent from WebView use onMessage prop on <WebView> | |
| ... | |
| <WebView | |
| ref="webview" | |
| onMessage={this.onMessage} | |
| /> | |
| onMessage(data) { | |
| //Prints out data that was passed. | |
| console.log(data); | |
| } | |
| .... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment