Thibault Malbranche 6 years ago
parent
commit
62b560a546

+ 7
- 0
android/src/main/java/com/reactnativecommunity/webview/RCTWebViewManager.java View File

@@ -574,6 +574,13 @@ public class RCTWebViewManager extends SimpleViewManager<WebView> {
574 574
     }
575 575
   }
576 576
 
577
+  @ReactProp(name = "allowFileAccess")
578
+  public void setAllowFileAccess(
579
+    WebView view,
580
+    @Nullable Boolean allowFileAccess) {
581
+    view.getSettings().setAllowFileAccess(allowFileAccess != null && allowFileAccess);
582
+  }
583
+
577 584
   @ReactProp(name = "geolocationEnabled")
578 585
   public void setGeolocationEnabled(
579 586
     WebView view,

+ 2
- 0
js/WebView.android.js View File

@@ -67,6 +67,7 @@ class WebView extends React.Component<WebViewSharedProps, State> {
67 67
     javaScriptEnabled: true,
68 68
     thirdPartyCookiesEnabled: true,
69 69
     scalesPageToFit: true,
70
+    allowFileAccess: false,
70 71
     saveFormDataDisabled: false,
71 72
     originWhitelist: WebViewShared.defaultOriginWhitelist,
72 73
   };
@@ -143,6 +144,7 @@ class WebView extends React.Component<WebViewSharedProps, State> {
143 144
         style={webViewStyles}
144 145
         source={resolveAssetSource(source)}
145 146
         scalesPageToFit={this.props.scalesPageToFit}
147
+        allowFileAccess={this.props.allowFileAccess}
146 148
         injectedJavaScript={this.props.injectedJavaScript}
147 149
         userAgent={this.props.userAgent}
148 150
         javaScriptEnabled={this.props.javaScriptEnabled}