`onFileDownload` is called with the URL that you can use to download the file.
When RNCWebView detects that the HTTP response should result in a file download,
`onFileDownload` is called. The client can then provide code to download
the file.
RNCWebView determines that a file download should take place if either of the
following is true:
1. The HTTP response contains a `Content-Disposition` header that is of type
'attachment'
2. The MIME type of the response cannot be rendered by the iOS WebView
* [apple] Move iOS/macOS src into common apple dir
* [apple] Enable macOS as platform in podspec
* [example] Use CocoaPods & auto-linking on macOS
* [docs] Update setup for macOS
* [package] Include apple dir in distribution
* Fixes Issue #1140
Fixes https://github.com/react-native-community/react-native-webview/issues/1140
Based on a solution found at: https://stackoverflow.com/questions/56460362/how-to-force-wkwebview-to-ignore-hardware-silent-switch-on-ios
I changed the code found in the linked source from Swift to Objective-C, as required by this project. WARNING: I haven't used Swift before and very limited experience with Objective-C.
- For me this seems to work, but it is not the cleanest solution in my opinion.
- It might also be possible to play generated sound (i.e. using oscillator) instead of hardcoding the silent base64 mp3 data.
- Maybe ignoring silence switch should only be done if a parameter is supplied
* fixes import path
* adds documentation for ignoreSilentHardwareSwitch
* adds ignoreSilentHardwareSwitch parameter
* reverting back to old import path
* Update Guide.md
Co-authored-by: Dominik Beste <dominik.beste@gmail.com>
* Don't show camera options for a file upload that would result in nothing happening for the user.
On Android, if the application declares the camera permission, then even intents
that use the camera require permission to be granted. This is a problem for apps
that combine an in-app camera with a WebView that has file uploading and the user
has not given permission for the camera.
Note, this will not request permission for camera. This will simply prevent
showing the camera options that would be a no-op action for users. It does this
by checking if the camera permission is declared, and if so, checks that the
user has granted permission.
More information: https://blog.egorand.me/taking-photos-not-so-simply-how-i-got-bitten-by-action_image_capture/
* Add example and documentation about camera option availability in file uploads for Android.
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.
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)
* Filter out extra onLoadProgress calls; add url to onLoadProgress
* remove note about onLoadProgress not having the url property in docs
* Update Reference.md
After needing to see what the origin of a "html" source'd WebView would be, I found the documentation that baseUrl would be utilized for the "origin" header when CORS requests are made.
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
* Adding a `contentInsetAdjustmentBehavior` prop to the WebView for iOS.
This controls the way iOS will automatically adjust the insets when the
webview is behind things like the iPhone X notch.
* Removing the code to explicitly pass contentInsetAdjustmentBehavior to the WebView since it is already passed in otherProps.