I am using the following code:
componentDidMount() {
try {
this.webView.current.executeJavaScript("$('body, window').scrollTop(100)")
} catch (err) {
console.log("[DidMount]", err.message);
}
setTimeout(() => {
this.webView.current.executeJavaScript("$('body, window').scrollTop(100)")
}, 1000);
}
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?
I am using the following code:
This results in a message
[DidMount] WebView is not ready yet, you can't call this methodfollowed by a scroll after the timeout period.I also tried
onDomReadyevent 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?