mrcoinbase 4 年之前
父節點
當前提交
aa2517b3b6
No account linked to committer's email address

+ 5
- 0
android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java 查看文件

@@ -252,6 +252,11 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
252 252
     view.getSettings().setJavaScriptEnabled(enabled);
253 253
   }
254 254
 
255
+  @ReactProp(name = "setSupportMultipleWindows")
256
+  public void setSupportMultipleWindows(WebView view, boolean enabled){
257
+    view.getSettings().setSupportMultipleWindows(enabled);
258
+  }
259
+
255 260
   @ReactProp(name = "showsHorizontalScrollIndicator")
256 261
   public void setShowsHorizontalScrollIndicator(WebView view, boolean enabled) {
257 262
     view.setHorizontalScrollBarEnabled(enabled);

+ 15
- 0
docs/Reference.md 查看文件

@@ -72,6 +72,7 @@ This document lays out the current public properties and methods for the React N
72 72
 - [`ignoreSilentHardwareSwitch`](Reference.md#ignoreSilentHardwareSwitch)
73 73
 - [`onFileDownload`](Reference.md#onFileDownload)
74 74
 - [`autoManageStatusBarEnabled`](Reference.md#autoManageStatusBarEnabled)
75
+- [`setSupportMultipleWindows`](Reference.md#setSupportMultipleWindows)
75 76
 
76 77
 ## Methods Index
77 78
 
@@ -1281,6 +1282,20 @@ Example:
1281 1282
 <WebView autoManageStatusBarEnabled={false} />
1282 1283
 ```
1283 1284
 
1285
+### `setSupportMultipleWindows`
1286
+
1287
+Sets whether the WebView supports multiple windows. See [Android documentation]('https://developer.android.com/reference/android/webkit/WebSettings#setSupportMultipleWindows(boolean)') for more information. 
1288
+
1289
+| Type    | Required | Default | Platform |
1290
+| ------- | -------- | ------- | -------- |
1291
+| boolean | No       | true    | Android  |
1292
+
1293
+Example:
1294
+
1295
+```javascript
1296
+<WebView setSupportMultipleWindows={false} />
1297
+```
1298
+
1284 1299
 ## Methods
1285 1300
 
1286 1301
 ### `extraNativeComponentConfig()`[⬆](#methods-index)<!-- Link generated with jump2header -->

+ 1
- 0
src/WebView.android.tsx 查看文件

@@ -63,6 +63,7 @@ class WebView extends React.Component<AndroidWebViewProps, State> {
63 63
     androidHardwareAccelerationDisabled: false,
64 64
     androidLayerType: 'none',
65 65
     originWhitelist: defaultOriginWhitelist,
66
+    setSupportMultipleWindows: true,
66 67
   };
67 68
 
68 69
   static isFileUploadSupported = async () => {

+ 9
- 0
src/WebViewTypes.ts 查看文件

@@ -295,6 +295,7 @@ export interface AndroidNativeWebViewProps extends CommonNativeWebViewProps {
295 295
   onRenderProcessGone?: (event: WebViewRenderProcessGoneEvent) => void;
296 296
   overScrollMode?: OverScrollModeType;
297 297
   saveFormDataDisabled?: boolean;
298
+  setSupportMultipleWindows?: boolean;
298 299
   textZoom?: number;
299 300
   thirdPartyCookiesEnabled?: boolean;
300 301
   messagingModuleName?: string;
@@ -799,6 +800,14 @@ export interface AndroidWebViewProps extends WebViewSharedProps {
799 800
    */
800 801
   saveFormDataDisabled?: boolean;
801 802
 
803
+  /**
804
+   * Boolean value to set whether the WebView supports multiple windows. Used on Android only
805
+   * The default value is `true`.
806
+   * @platform android
807
+   */
808
+  setSupportMultipleWindows?: boolean;
809
+
810
+
802 811
   /**
803 812
    * Used on Android only, controls whether the given list of URL prefixes should
804 813
    * make {@link com.facebook.react.views.webview.ReactWebViewClient} to launch a