浏览代码

Merge branch 'master' into android-build-adjustments

Thibault Malbranche 5 年前
父节点
当前提交
184ae07395
没有帐户链接到提交者的电子邮件

+ 10
- 0
.all-contributorsrc 查看文件

@@ -73,6 +73,16 @@
73 73
         "code",
74 74
         "doc"
75 75
       ]
76
+    },
77
+    {
78
+      "login": "YangXiaomei",
79
+      "name": "Margaret",
80
+      "avatar_url": "https://avatars0.githubusercontent.com/u/8221990?v=4",
81
+      "profile": "https://github.com/YangXiaomei",
82
+      "contributions": [
83
+        "code",
84
+        "doc"
85
+      ]
76 86
     }
77 87
   ],
78 88
   "contributorsPerLine": 7

+ 3
- 3
README.md 查看文件

@@ -1,5 +1,5 @@
1 1
 # React Native WebView - a Modern, Cross-Platform WebView for React Native
2
-[![All Contributors](https://img.shields.io/badge/all_contributors-5-orange.svg?style=flat-square)](#contributors)
2
+[![star this repo](http://githubbadges.com/star.svg?user=react-native-community&repo=react-native-webview&style=flat)](https://github.com/react-native-community/react-native-webview) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) [![All Contributors](https://img.shields.io/badge/all_contributors-6-orange.svg?style=flat-square)](#contributors) [![Known Vulnerabilities](https://snyk.io/test/github/react-native-community/react-native-webview/badge.svg?style=flat-square)](https://snyk.io/test/github/react-native-community/react-native-webview) 
3 3
 
4 4
 **React Native WebView** is a modern, well-supported, and cross-platform WebView for React Native. It is intended to be a replacement for the built-in WebView (which will be [removed from core](https://github.com/react-native-community/discussions-and-proposals/pull/3)).
5 5
 
@@ -84,8 +84,8 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/all-contri
84 84
 
85 85
 <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
86 86
 <!-- prettier-ignore -->
87
-| [<img src="https://avatars1.githubusercontent.com/u/6181446?v=4" width="100px;" alt="Thibault Malbranche"/><br /><sub><b>Thibault Malbranche</b></sub>](https://twitter.com/titozzz)<br />[💻](https://github.com/react-native-community/react-native-webview/commits?author=titozzz "Code") [🤔](#ideas-titozzz "Ideas, Planning, & Feedback") [👀](#review-titozzz "Reviewed Pull Requests") [📖](https://github.com/react-native-community/react-native-webview/commits?author=titozzz "Documentation") [🚧](#maintenance-titozzz "Maintenance") [⚠️](https://github.com/react-native-community/react-native-webview/commits?author=titozzz "Tests") [🚇](#infra-titozzz "Infrastructure (Hosting, Build-Tools, etc)") [💬](#question-titozzz "Answering Questions") | [<img src="https://avatars3.githubusercontent.com/u/1479215?v=4" width="100px;" alt="Jamon Holmgren"/><br /><sub><b>Jamon Holmgren</b></sub>](https://jamonholmgren.com)<br />[💻](https://github.com/react-native-community/react-native-webview/commits?author=jamonholmgren "Code") [🤔](#ideas-jamonholmgren "Ideas, Planning, & Feedback") [👀](#review-jamonholmgren "Reviewed Pull Requests") [📖](https://github.com/react-native-community/react-native-webview/commits?author=jamonholmgren "Documentation") [🚧](#maintenance-jamonholmgren "Maintenance") [⚠️](https://github.com/react-native-community/react-native-webview/commits?author=jamonholmgren "Tests") [💡](#example-jamonholmgren "Examples") [💬](#question-jamonholmgren "Answering Questions") | [<img src="https://avatars1.githubusercontent.com/u/2570562?v=4" width="100px;" alt="Andrei Pfeiffer"/><br /><sub><b>Andrei Pfeiffer</b></sub>](https://github.com/andreipfeiffer)<br />[💻](https://github.com/react-native-community/react-native-webview/commits?author=andreipfeiffer "Code") [👀](#review-andreipfeiffer "Reviewed Pull Requests") [🤔](#ideas-andreipfeiffer "Ideas, Planning, & Feedback") | [<img src="https://avatars0.githubusercontent.com/u/5347038?v=4" width="100px;" alt="Michael Diarmid"/><br /><sub><b>Michael Diarmid</b></sub>](https://twitter.com/mikediarmid)<br />[💻](https://github.com/react-native-community/react-native-webview/commits?author=Salakar "Code") [👀](#review-Salakar "Reviewed Pull Requests") [🤔](#ideas-Salakar "Ideas, Planning, & Feedback") [🔧](#tool-Salakar "Tools") | [<img src="https://avatars3.githubusercontent.com/u/932981?v=4" width="100px;" alt="Scott Mathson"/><br /><sub><b>Scott Mathson</b></sub>](http://smathson.github.io)<br />[💻](https://github.com/react-native-community/react-native-webview/commits?author=smathson "Code") [📖](https://github.com/react-native-community/react-native-webview/commits?author=smathson "Documentation") |
88
-| :---: | :---: | :---: | :---: | :---: |
87
+| [<img src="https://avatars1.githubusercontent.com/u/6181446?v=4" width="100px;" alt="Thibault Malbranche"/><br /><sub><b>Thibault Malbranche</b></sub>](https://twitter.com/titozzz)<br />[💻](https://github.com/react-native-community/react-native-webview/commits?author=titozzz "Code") [🤔](#ideas-titozzz "Ideas, Planning, & Feedback") [👀](#review-titozzz "Reviewed Pull Requests") [📖](https://github.com/react-native-community/react-native-webview/commits?author=titozzz "Documentation") [🚧](#maintenance-titozzz "Maintenance") [⚠️](https://github.com/react-native-community/react-native-webview/commits?author=titozzz "Tests") [🚇](#infra-titozzz "Infrastructure (Hosting, Build-Tools, etc)") [💬](#question-titozzz "Answering Questions") | [<img src="https://avatars3.githubusercontent.com/u/1479215?v=4" width="100px;" alt="Jamon Holmgren"/><br /><sub><b>Jamon Holmgren</b></sub>](https://jamonholmgren.com)<br />[💻](https://github.com/react-native-community/react-native-webview/commits?author=jamonholmgren "Code") [🤔](#ideas-jamonholmgren "Ideas, Planning, & Feedback") [👀](#review-jamonholmgren "Reviewed Pull Requests") [📖](https://github.com/react-native-community/react-native-webview/commits?author=jamonholmgren "Documentation") [🚧](#maintenance-jamonholmgren "Maintenance") [⚠️](https://github.com/react-native-community/react-native-webview/commits?author=jamonholmgren "Tests") [💡](#example-jamonholmgren "Examples") [💬](#question-jamonholmgren "Answering Questions") | [<img src="https://avatars1.githubusercontent.com/u/2570562?v=4" width="100px;" alt="Andrei Pfeiffer"/><br /><sub><b>Andrei Pfeiffer</b></sub>](https://github.com/andreipfeiffer)<br />[💻](https://github.com/react-native-community/react-native-webview/commits?author=andreipfeiffer "Code") [👀](#review-andreipfeiffer "Reviewed Pull Requests") [🤔](#ideas-andreipfeiffer "Ideas, Planning, & Feedback") | [<img src="https://avatars0.githubusercontent.com/u/5347038?v=4" width="100px;" alt="Michael Diarmid"/><br /><sub><b>Michael Diarmid</b></sub>](https://twitter.com/mikediarmid)<br />[💻](https://github.com/react-native-community/react-native-webview/commits?author=Salakar "Code") [👀](#review-Salakar "Reviewed Pull Requests") [🤔](#ideas-Salakar "Ideas, Planning, & Feedback") [🔧](#tool-Salakar "Tools") | [<img src="https://avatars3.githubusercontent.com/u/932981?v=4" width="100px;" alt="Scott Mathson"/><br /><sub><b>Scott Mathson</b></sub>](http://smathson.github.io)<br />[💻](https://github.com/react-native-community/react-native-webview/commits?author=smathson "Code") [📖](https://github.com/react-native-community/react-native-webview/commits?author=smathson "Documentation") | [<img src="https://avatars0.githubusercontent.com/u/8221990?v=4" width="100px;" alt="Margaret"/><br /><sub><b>Margaret</b></sub>](https://github.com/YangXiaomei)<br />[💻](https://github.com/react-native-community/react-native-webview/commits?author=YangXiaomei "Code") [📖](https://github.com/react-native-community/react-native-webview/commits?author=YangXiaomei "Documentation") |
88
+| :---: | :---: | :---: | :---: | :---: | :---: |
89 89
 <!-- ALL-CONTRIBUTORS-LIST:END -->
90 90
 
91 91
 This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!

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

@@ -529,6 +529,13 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
529 529
     view.getSettings().setJavaScriptEnabled(enabled);
530 530
   }
531 531
 
532
+  @ReactProp(name = "androidHardwareAccelerationDisabled")
533
+  public void setHardwareAccelerationDisabled(WebView view, boolean disabled) {
534
+    if (disabled) {
535
+      view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
536
+    }
537
+  }
538
+
532 539
   @ReactProp(name = "overScrollMode")
533 540
   public void setOverScrollMode(WebView view, String overScrollModeString) {
534 541
     Integer overScrollMode;

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

@@ -28,6 +28,7 @@ This document lays out the current public properties and methods for the React N
28 28
 - [`decelerationRate`](Reference.md#decelerationrate)
29 29
 - [`domStorageEnabled`](Reference.md#domstorageenabled)
30 30
 - [`javaScriptEnabled`](Reference.md#javascriptenabled)
31
+- [`androidHardwareAccelerationDisabled`](Reference.md#androidHardwareAccelerationDisabled)
31 32
 - [`mixedContentMode`](Reference.md#mixedcontentmode)
32 33
 - [`thirdPartyCookiesEnabled`](Reference.md#thirdpartycookiesenabled)
33 34
 - [`userAgent`](Reference.md#useragent)
@@ -319,6 +320,16 @@ Boolean value to enable JavaScript in the `WebView`. Used on Android only as Jav
319 320
 
320 321
 ---
321 322
 
323
+### `androidHardwareAccelerationDisabled`
324
+
325
+Boolean value to disable Hardware Acceleration in the `WebView`. Used on Android only as Hardware Acceleration is a feature only for Android. The default value is `false`.
326
+
327
+| Type | Required | Platform |
328
+| ---- | -------- | -------- |
329
+| bool | No       | Android  |
330
+
331
+---
332
+
322 333
 ### `mixedContentMode`
323 334
 
324 335
 Specifies the mixed content mode. i.e WebView will allow a secure origin to load content from any other origin.

+ 2
- 0
js/WebView.android.js 查看文件

@@ -67,6 +67,7 @@ class WebView extends React.Component<WebViewSharedProps, State> {
67 67
     scalesPageToFit: true,
68 68
     allowFileAccess: false,
69 69
     saveFormDataDisabled: false,
70
+    androidHardwareAccelerationDisabled: false,
70 71
     originWhitelist: defaultOriginWhitelist,
71 72
   };
72 73
 
@@ -150,6 +151,7 @@ class WebView extends React.Component<WebViewSharedProps, State> {
150 151
         injectedJavaScript={this.props.injectedJavaScript}
151 152
         userAgent={this.props.userAgent}
152 153
         javaScriptEnabled={this.props.javaScriptEnabled}
154
+        androidHardwareAccelerationDisabled={this.props.androidHardwareAccelerationDisabled}
153 155
         thirdPartyCookiesEnabled={this.props.thirdPartyCookiesEnabled}
154 156
         domStorageEnabled={this.props.domStorageEnabled}
155 157
         messagingEnabled={typeof this.props.onMessage === 'function'}

+ 7
- 0
js/WebViewTypes.js 查看文件

@@ -313,6 +313,13 @@ export type AndroidWebViewProps = $ReadOnly<{|
313 313
    */
314 314
   javaScriptEnabled?: ?boolean,
315 315
 
316
+  /**
317
+   * Boolean value to disable Hardware Acceleration in the `WebView`. Used on Android only
318
+   * as Hardware Acceleration is a feature only for Android. The default value is `false`.
319
+   * @platform android
320
+   */
321
+  androidHardwareAccelerationDisabled?: ?boolean,
322
+
316 323
   /**
317 324
    * Boolean value to enable third party cookies in the `WebView`. Used on
318 325
    * Android Lollipop and above only as third party cookies are enabled by

+ 1
- 1
package.json 查看文件

@@ -8,7 +8,7 @@
8 8
     "Thibault Malbranche <malbranche.thibault@gmail.com>"
9 9
   ],
10 10
   "license": "MIT",
11
-  "version": "3.1.3",
11
+  "version": "3.2.0",
12 12
   "homepage": "https://github.com/react-native-community/react-native-webview#readme",
13 13
   "scripts": {
14 14
     "test:ios:flow": "flow check",

+ 7
- 0
typings/index.d.ts 查看文件

@@ -287,6 +287,13 @@ export interface AndroidWebViewProps {
287 287
    */
288 288
   javaScriptEnabled?: boolean;
289 289
 
290
+  /**
291
+   * Boolean value to disable Hardware Acceleration in the `WebView`. Used on Android only
292
+   * as Hardware Acceleration is a feature only for Android. The default value is `false`.
293
+   * @platform android
294
+   */
295
+  androidHardwareAccelerationDisabled?: boolean;
296
+
290 297
   /**
291 298
    * Boolean value to enable third party cookies in the `WebView`. Used on
292 299
    * Android Lollipop and above only as third party cookies are enabled by