Skip to content

Commit

Permalink
Merge pull request #1754 from dagmawig/main
Browse files Browse the repository at this point in the history
feat: add postMessage method to send message to react native webview
  • Loading branch information
dadiorchen authored Feb 11, 2024
2 parents 1aa4afa + 85af407 commit 1ae907f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,12 @@ function MapComponent() {

async function handleClickTree(tree) {
log.warn('click tree:', tree);
if (window.ReactNativeWebView) {
log.debug('react native');
window.ReactNativeWebView?.postMessage(JSON.stringify(tree));
}
if (window.parent) {
log.warn('DEMO:ok message parent');
log.debug('window.parent');
window.parent.postMessage(JSON.stringify(tree), '*');
}

Expand Down

0 comments on commit 1ae907f

Please sign in to comment.