feat(android): allowFileAccessFromFileURLs prop added (#831)

* add allowFileAccessFromFileURLs propery to do the expected on android

* Added types

* Update WebViewTypes.ts
This commit is contained in:
Borut Balazek
2019-09-29 15:50:39 +02:00
committed by Thibault Malbranche
parent 089ca67c6e
commit 4db3d84dda
3 changed files with 26 additions and 0 deletions
@@ -371,6 +371,11 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
view.getSettings().setMediaPlaybackRequiresUserGesture(requires);
}
@ReactProp(name = "allowFileAccessFromFileURLs")
public void setAllowFileAccessFromFileURLs(WebView view, boolean allow) {
view.getSettings().setAllowFileAccessFromFileURLs(allow);
}
@ReactProp(name = "allowUniversalAccessFromFileURLs")
public void setAllowUniversalAccessFromFileURLs(WebView view, boolean allow) {
view.getSettings().setAllowUniversalAccessFromFileURLs(allow);
+11
View File
@@ -44,6 +44,7 @@ This document lays out the current public properties and methods for the React N
- [`scrollEnabled`](Reference.md#scrollenabled)
- [`directionalLockEnabled`](Reference.md#directionalLockEnabled)
- [`geolocationEnabled`](Reference.md#geolocationenabled)
- [`allowFileAccessFromFileURLs`](Reference.md#allowFileAccessFromFileURLs)
- [`allowUniversalAccessFromFileURLs`](Reference.md#allowUniversalAccessFromFileURLs)
- [`allowingReadAccessToURL`](Reference.md#allowingReadAccessToURL)
- [`url`](Reference.md#url)
@@ -876,6 +877,16 @@ Set whether Geolocation is enabled in the `WebView`. The default value is `false
---
### `allowFileAccessFromFileURLs`
Boolean that sets whether JavaScript running in the context of a file scheme URL should be allowed to access content from other file scheme URLs. The default value is `false`.
| Type | Required | Platform |
| ---- | -------- | -------- |
| bool | No | Android |
---
### `allowUniversalAccessFromFileURLs`
Boolean that sets whether JavaScript running in the context of a file scheme URL should be allowed to access content from any origin. Including accessing content from other file scheme URLs. The default value is `false`.
+10
View File
@@ -242,6 +242,7 @@ export interface AndroidNativeWebViewProps extends CommonNativeWebViewProps {
cacheMode?: CacheMode;
allowFileAccess?: boolean;
scalesPageToFit?: boolean;
allowFileAccessFromFileURLs?: boolean;
allowUniversalAccessFromFileURLs?: boolean;
androidHardwareAccelerationDisabled?: boolean;
domStorageEnabled?: boolean;
@@ -500,6 +501,15 @@ export interface AndroidWebViewProps extends WebViewSharedProps {
*/
geolocationEnabled?: boolean;
/**
* Boolean that sets whether JavaScript running in the context of a file
* scheme URL should be allowed to access content from other file scheme URLs.
* Including accessing content from other file scheme URLs
* @platform android
*/
allowFileAccessFromFileURLs?: boolean;
/**
* Boolean that sets whether JavaScript running in the context of a file
* scheme URL should be allowed to access content from any origin.