Просмотр исходного кода

Merge branch 'master' into dependencies-update

Thibault Malbranche 4 лет назад
Родитель
Сommit
7eb979b69c
No account linked to committer's email address

+ 19
- 1
android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java Просмотреть файл

@@ -16,6 +16,7 @@ import android.os.Environment;
16 16
 import androidx.annotation.RequiresApi;
17 17
 import androidx.core.content.ContextCompat;
18 18
 import android.text.TextUtils;
19
+import android.view.MotionEvent;
19 20
 import android.view.Gravity;
20 21
 import android.view.View;
21 22
 import android.view.ViewGroup;
@@ -363,7 +364,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
363 364
   public void setMessagingEnabled(WebView view, boolean enabled) {
364 365
     ((RNCWebView) view).setMessagingEnabled(enabled);
365 366
   }
366
-   
367
+
367 368
   @ReactProp(name = "incognito")
368 369
   public void setIncognito(WebView view, boolean enabled) {
369 370
     // Remove all previous cookies
@@ -910,6 +911,23 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
910 911
       this.hasScrollEvent = hasScrollEvent;
911 912
     }
912 913
 
914
+    @Override
915
+    public boolean onTouchEvent(MotionEvent event){
916
+
917
+      // Allow scrolling inside ScrollView
918
+      if (event.findPointerIndex(0) == -1) {
919
+        return super.onTouchEvent(event);
920
+      }
921
+
922
+      if (event.getPointerCount() >= 1) {
923
+        requestDisallowInterceptTouchEvent(true);
924
+      } else {
925
+        requestDisallowInterceptTouchEvent(false);
926
+      }
927
+
928
+      return super.onTouchEvent(event);
929
+    }
930
+
913 931
     @Override
914 932
     public void onHostResume() {
915 933
       // do nothing

+ 1
- 1
docs/Reference.md Просмотреть файл

@@ -90,7 +90,7 @@ The object passed to `source` can have either of the following shapes:
90 90
 _Note that using static HTML requires the WebView property [originWhiteList](Reference.md#originWhiteList) to `['*']`. For some content, such as video embeds (e.g. Twitter or Facebook posts with video), the baseUrl needs to be set for the video playback to work_
91 91
 
92 92
 - `html` (string) - A static HTML page to display in the WebView.
93
-- `baseUrl` (string) - The base URL to be used for any relative links in the HTML.
93
+- `baseUrl` (string) - The base URL to be used for any relative links in the HTML. This is also used for the origin header with CORS requests made from the WebView. See [Android WebView Docs](https://developer.android.com/reference/android/webkit/WebView#loadDataWithBaseURL)
94 94
 
95 95
 | Type   | Required |
96 96
 | ------ | -------- |

+ 2
- 0
index.d.ts Просмотреть файл

@@ -2,6 +2,8 @@ import { Component } from 'react';
2 2
 // eslint-disable-next-line
3 3
 import { IOSWebViewProps, AndroidWebViewProps } from './lib/WebViewTypes';
4 4
 
5
+export { WebViewMessageEvent, WebViewNavigation } from "./lib/WebViewTypes";
6
+
5 7
 export type WebViewProps = IOSWebViewProps & AndroidWebViewProps;
6 8
 
7 9
 declare class WebView extends Component<WebViewProps> {

+ 1
- 1
ios/RNCWebView.m Просмотреть файл

@@ -438,7 +438,7 @@ static NSURLCredential* clientAuthenticationCredential;
438 438
         [_webView loadRequest:request];
439 439
     }
440 440
     else {
441
-        NSURL* readAccessUrl = _allowingReadAccessToURL ? [NSURL URLWithString:_allowingReadAccessToURL] : request.URL;
441
+        NSURL* readAccessUrl = _allowingReadAccessToURL ? [RCTConvert NSURL:_allowingReadAccessToURL] : request.URL;
442 442
         [_webView loadFileURL:request.URL allowingReadAccessToURL:readAccessUrl];
443 443
     }
444 444
 }

+ 5
- 1
package.json Просмотреть файл

@@ -8,7 +8,7 @@
8 8
     "Thibault Malbranche <malbranche.thibault@gmail.com>"
9 9
   ],
10 10
   "license": "MIT",
11
-  "version": "7.0.3",
11
+  "version": "7.0.6",
12 12
   "homepage": "https://github.com/react-native-community/react-native-webview#readme",
13 13
   "scripts": {
14 14
     "ci": "CI=true && yarn lint && yarn test",
@@ -18,6 +18,10 @@
18 18
     "prepare": "yarn build",
19 19
     "test": "yarn jest"
20 20
   },
21
+  "rn-docs": {
22
+    "title": "Webview",
23
+    "type": "Component"
24
+  },
21 25
   "peerDependencies": {
22 26
     "react": "^16.0",
23 27
     "react-native": ">=0.60 <0.62"