Open MCTaylor17 opened 6 years ago
Found a solution to this so I will post my findings for anyone who ends up here. I used useEffect to make this work. I am using functional components but should still work if you use the same concept. All this does is open the devtools but you can obviously add anything you want. in the body of the dom-ready event listener.
useEffect(() => { const webview = document.querySelector('webview') webview.addEventListener("dom-ready", function(){ webview.openDevTools() }) })
I am using the following code:
This results in a message
[DidMount] WebView is not ready yet, you can't call this method
followed by a scroll after the timeout period.I also tried
onDomReady
event handler which fires even earlier with the message[DomReady] Cannot read property 'executeJavaScript' of null
.What is the best method of invoking a method when the webview is ready?