React Native Webview OnLoad вызывается дважды - PullRequest
0 голосов
/ 27 марта 2020

Реагирует на собственное веб-представление onLoad (), onLoadStart (), onLoadEnd (), все вызываются дважды

Найдите мой код ниже

<WebView
  source={{
    uri,
  }}
  // eslint-disable-next-line no-return-assign
  ref={ref => (this.webview = ref)}
  startInLoadingState
  style={{ marginTop: 0, flex: 1 }}
  renderLoading={() => this.displaySpinner()}
  javaScriptEnabled
  geolocationEnabled
  injectedJavaScript={setTimeoutInjection}
  onLoad={() => this.pageLoadEnd(renderTime)}
  onLoadStart={() => {
    Alert.alert('On load event', `Loading time : ${Date.now() - renderTime}`)
  }}
  onLoadEnd={() => {
    Alert.alert('On load event End', `Loading time : ${Date.now() - renderTime}`)
  }}
  sharedCookiesEnabled
  useWebKit
  onNavigationStateChange={this._onNavigationStateChange.bind(this)}
/>

Что я должен изменить, чтобы события onload () звонили только один раз?

...