如何在react-native-webview中获取SPA的网址更改事件?

时间:2020-09-27 08:56:42

标签: react-native webview react-native-webview

我正在使用react-native-webview来显示网络视图。当我更改任何页面(非SPA)事件时都会触发。但是,当我在SPA应用程序onNavigationStateChange中更改url时,不会触发事件。是否有可能在SPA中触发事件

import {WebView} from 'react-native-webview';

<WebView
  source={{uri: 'https://www.flipkart.com/'}}
  bounces={true}
  startInLoadingState
  scalesPageToFit
  javaScriptEnabledAndroid={true}
  javaScriptEnabled={true}
  onNavigationStateChange={handleNavigationStateChange}
  onLoadStart={() => {
    console.log('LOAD START ');
  }}
  onLoadEnd={() => {
    console.log('LOAD END');
  }}
  onError={(err) => {
    console.log('ERROR ');
    console.log(err);
  }}
/>

0 个答案:

没有答案