The WebView component that comes with RN does not listen for routing changes on a single page of H5.

WebView page, to get the latest status of the page through the onNavigationStateChange event, one is to update the return button, and the other is to take the page title. There is nothing wrong with ordinary multiple pages, but there will be problems with a single page.

the two routes on a single page have different problems under the monitoring of webView:

  1. hash routing: you can listen for route changes, but the title of the obtained web page is
  2. of the previous route.
  3. history routing: no action can be heard at all

finally, there is no problem with the same web page in Wechat"s WebView. It is estimated that there is no way to solve the WebView that comes with RN. Is there any other third-party WebView that can support single-page H5 monitoring?

Mar.13,2021

@ Master Xiao encountered the same problem. Have you solved it?


, I also encountered


after more than a year, you have finally found the reason.
recently I am learning that oc, uses WKWebView
to find that one way to listen for more routing changes on the native side is through this method of webView:

  https://github.com/react-nati.

Menu