Skip to content

WebView is not ready yet... #14

@MCTaylor17

Description

@MCTaylor17

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions