lucasferreira / react-native-webview-android

Simple React Native Android module to use Android's WebView inside your app
355 stars 158 forks source link

it not have onError or onLoad method #95

Open tmxiong opened 6 years ago

tmxiong commented 6 years ago

it not have onError or onLoad method, How do I judge whether web pages have been loaded or failed?

lucasferreira commented 6 years ago

Hi @tmxiong

I think tath if you use the onNavigationStateChange event-method you could monitor de event argument and discover the 'loaded' moment of your URL.

jeremy8883 commented 6 years ago

Looking at the navState object that we get back from onNavigationStateChange, it looks like this:

{
  canGoBack: false
  canGoForward: false
  loading: false
  title: ""
  url: "https://mywebsite.com/"
}

So it works well for detecting the loading state, but it doesn't seem to show me when an error has occurred.