CRAlpha / CRAlpha/react-native-wkwebview
"onNavigationStateChange" Unable to listen for route changes for single-page applications
- Dominant language
- Objective-C
- Stars
- 637
- Forks
- 263
- PR merge metrics
- No merged PRs in 30d
Description
I use onNavigationStateChange to monitor the change of URL:
`onNavigationStateChange = (navState) => {
console.log(navState)
}`
however, it will not be called if the page your WKWebView is trying to open is a SPA.
# Environment
```
OS: macOS Sierra 10.13.6
Node: 8.9.1
Yarn: 0.24.5
npm: 5.4.0
Packages: (wanted => installed)
react-native: 0.53.0
react: 16.3.1
react-native-wkwebview-reborn: 1.22.0
```
## Steps to Reproduce
1.WKWebView opens https://eos.live and logs in
2.Click to jump to other pages
When the web page in WKWebView uses history.pushState () to change URL, onNavigationStateChange does not execute
## Expected Behavior
onNavigationStateChange executes after each URL change
## Actual Behavior
onNavigationStateChange does not execute every time URL changes
## Reproducible Demo
```
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the onNavigationStateChange entry point and the WKWebView navigation handling. Reproduce the issue with the provided eos.live SPA example and history.pushState URL changes; done means the callback executes after each URL change.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- objective-c, react-native
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100