* Added allowUniversalAccessFromFileURLs property to iOS and macOS
Updated the types to include allowUniversalAccessFromFileURLs and allowFileAccessFromFileURLs for iOS and macOS
Updated the Reference.md to include in the allowUniversalAccessFromFileURLs section iOS and macOS
* Updated platform in the type definition
* fix:iOS13 scrollView.automaticallyAdjustsScrollIndicatorInsets default value YES which make the webview vertical indicator position in wrong offset
* added types and doc
Co-authored-by: BillHsieh <xietian@meitunmama.com>
Co-authored-by: xietian <xietian@innotechx.com>
Co-authored-by: Thibault Malbranche <thibault.malbranche@epitech.eu>
Co-authored-by: Thibault Malbranche <malbranche.thibault@gmail.com>
BREAKING CHANGE:
This release introduces the `setSupportMultipleWindows` prop for Android. This sets the underlying Android WebView setting `setSupportMultipleWindows`. This prop defaults to `true` (previously `false`), and serves to mitigate the security advisory [CVE-2020-6506](https://github.com/react-native-webview/react-native-webview/security/advisories/GHSA-36j3-xxf7-4pqg).
The primary way this new behavior changes existing React Native WebView implementations on Android is that links that open in new tabs/windows (such as `<a target="_blank">`) will now prompt to open in the system browser, rather than re-using the current WebView.
If this behavior is not desirable, you can set this new prop to `false`, but be aware that this exposes your app to the security vulnerability listed above. Make sure you have read and understand the whole advisory and relevant links.
iOS & Windows are unaffected.
```jsx
<WebView
// ...
setSupportMultipleWindows={true} // default: true
/>
```
Thanks to @mrcoinbase, @kelset, and @Titozzz for their work on this.
* Add pull to refresh support for iOS
* Add pull to refresh control removal from WebView
* Add the type and reference description about pull to refresh
* Set bounces to true when enabling pull to refresh, add references
* Add the back to props anchor to pullToRefreshEnabled
* Add isTopFrame to shouldStartLoadForRequest on iOS
onLoadingStart is not raised for inner frames, but onShouldStartLoadWithRequest still is. This keeps that behavior but adds isTopFrame to onShouldStartLoadWithRequest so that apps can perform their own filtering if desired.
* Update docs
Co-authored-by: Jamon Holmgren <jamonholmgren@gmail.com>
This allows overriding iPadOS 13's desktop-class browsing to load mobile content instead of desktop content.
Co-authored-by: Jamon Holmgren <jamonholmgren@gmail.com>
`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)