Browse Source

Merge branch 'master' into android-build-adjustments

Thibault Malbranche 6 years ago
parent
commit
184ae07395
No account linked to committer's email address

+ 10
- 0
.all-contributorsrc View File

73
         "code",
73
         "code",
74
         "doc"
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
   "contributorsPerLine": 7
88
   "contributorsPerLine": 7

+ 3
- 3
README.md View File

1
 # React Native WebView - a Modern, Cross-Platform WebView for React Native
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
 **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)).
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
 
84
 
85
 <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
85
 <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
86
 <!-- prettier-ignore -->
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
 <!-- ALL-CONTRIBUTORS-LIST:END -->
89
 <!-- ALL-CONTRIBUTORS-LIST:END -->
90
 
90
 
91
 This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
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 View File

529
     view.getSettings().setJavaScriptEnabled(enabled);
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
   @ReactProp(name = "overScrollMode")
539
   @ReactProp(name = "overScrollMode")
533
   public void setOverScrollMode(WebView view, String overScrollModeString) {
540
   public void setOverScrollMode(WebView view, String overScrollModeString) {
534
     Integer overScrollMode;
541
     Integer overScrollMode;

+ 11
- 0
docs/Reference.md View File

28
 - [`decelerationRate`](Reference.md#decelerationrate)
28
 - [`decelerationRate`](Reference.md#decelerationrate)
29
 - [`domStorageEnabled`](Reference.md#domstorageenabled)
29
 - [`domStorageEnabled`](Reference.md#domstorageenabled)
30
 - [`javaScriptEnabled`](Reference.md#javascriptenabled)
30
 - [`javaScriptEnabled`](Reference.md#javascriptenabled)
31
+- [`androidHardwareAccelerationDisabled`](Reference.md#androidHardwareAccelerationDisabled)
31
 - [`mixedContentMode`](Reference.md#mixedcontentmode)
32
 - [`mixedContentMode`](Reference.md#mixedcontentmode)
32
 - [`thirdPartyCookiesEnabled`](Reference.md#thirdpartycookiesenabled)
33
 - [`thirdPartyCookiesEnabled`](Reference.md#thirdpartycookiesenabled)
33
 - [`userAgent`](Reference.md#useragent)
34
 - [`userAgent`](Reference.md#useragent)
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
 ### `mixedContentMode`
333
 ### `mixedContentMode`
323
 
334
 
324
 Specifies the mixed content mode. i.e WebView will allow a secure origin to load content from any other origin.
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 View File

67
     scalesPageToFit: true,
67
     scalesPageToFit: true,
68
     allowFileAccess: false,
68
     allowFileAccess: false,
69
     saveFormDataDisabled: false,
69
     saveFormDataDisabled: false,
70
+    androidHardwareAccelerationDisabled: false,
70
     originWhitelist: defaultOriginWhitelist,
71
     originWhitelist: defaultOriginWhitelist,
71
   };
72
   };
72
 
73
 
150
         injectedJavaScript={this.props.injectedJavaScript}
151
         injectedJavaScript={this.props.injectedJavaScript}
151
         userAgent={this.props.userAgent}
152
         userAgent={this.props.userAgent}
152
         javaScriptEnabled={this.props.javaScriptEnabled}
153
         javaScriptEnabled={this.props.javaScriptEnabled}
154
+        androidHardwareAccelerationDisabled={this.props.androidHardwareAccelerationDisabled}
153
         thirdPartyCookiesEnabled={this.props.thirdPartyCookiesEnabled}
155
         thirdPartyCookiesEnabled={this.props.thirdPartyCookiesEnabled}
154
         domStorageEnabled={this.props.domStorageEnabled}
156
         domStorageEnabled={this.props.domStorageEnabled}
155
         messagingEnabled={typeof this.props.onMessage === 'function'}
157
         messagingEnabled={typeof this.props.onMessage === 'function'}

+ 7
- 0
js/WebViewTypes.js View File

313
    */
313
    */
314
   javaScriptEnabled?: ?boolean,
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
    * Boolean value to enable third party cookies in the `WebView`. Used on
324
    * Boolean value to enable third party cookies in the `WebView`. Used on
318
    * Android Lollipop and above only as third party cookies are enabled by
325
    * Android Lollipop and above only as third party cookies are enabled by

+ 1
- 1
package.json View File

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

+ 7
- 0
typings/index.d.ts View File

287
    */
287
    */
288
   javaScriptEnabled?: boolean;
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
    * Boolean value to enable third party cookies in the `WebView`. Used on
298
    * Boolean value to enable third party cookies in the `WebView`. Used on
292
    * Android Lollipop and above only as third party cookies are enabled by
299
    * Android Lollipop and above only as third party cookies are enabled by