feat(ios): Generate history API events on iOS (#1082)
BREAKING CHANGE: if you use onNavigationStateChange on iOS it will now trigger on # changes to the url.
* Hook the `window.history` API on iOS to generate events
The underlying WKWebView doesn't seem to generate any events in response to the `window.history` API - none of the `WKNavigationDelegate` methods fire.
Given this limitation, the only way to know when the location changes via this API is to inject Javascript into the page and have it notify the native code directly when any of these functions are called.
The `setTimeout` call gives up the current tick, allowing the location to change before firing the event.
* Remove the outdated section about hash changes
Now that this bug is fixed, the workaround is no longer required.
chore(docs): Steps to load local HTML files into the webview (#1008)
Fixes #746
These steps are based on my other project React native draftjs which requires loading a local HTML file. The code can be found in the following line - bc51410117/index.js (L113)
Apple required us to remove this (see #819)
BREAKING CHANGE: UIWebView has been removed
BREAKING CHANGE: useWebkit prop removal
BREAKING CHANGE: scalesPageToFit prop removal on iOS (since it's not compatible with WKWebview)
BREAKING CHANGE: Renamed RNCWKWebView to RNCWebView on iOS
feat(Android Webview): Add file download support for Android (#203)
Addresses #80.
Caveat: I am not an Android developer. This code comes from a fork of the original RN WebView that we have been using in production for some time, so all credit goes to @Oblongmana: https://github.com/Oblongmana/react-native-webview-file-upload-android.
Setting up a DownloadManager for the WebView is pretty straightforward, as is adding any known cookies to the request. Most of the complication comes from the requirement after SDK 23 to ask the user for the WRITE_EXTERNAL_STORAGE permission. Unfortunately there is no mechanism to suspend the download request until permission is resolved so this code stores off the request and sets up a listener that enqueues the download once permissions are resolved so the user experience is really nice.
I didn't see anything in the way of tests or documentation that needs to be added for this change, so let me know if I missed anything. Thanks!
Fixes #33
I could really use some help from an Android developer on this one, because I just "made it work", don't know how to "make it work good".
Some things that should be reviewed:
- [ ] validate Android 5.0 devices (my emulator work, but outputs some weird sounds; a Galaxy 4 I tested on crashes)
- [ ] validate Android 5.1 devices (emulator works, couldn't find a real device)
- [ ] how to handle File Extensions? (https://www.w3schools.com/tags/att_input_accept.asp)
I'm sure that there's more refactoring to be done, so any help and advice would be appreciated.