ソースを参照

Merge branch 'master' into docs/debugging-tweak

Thibault Malbranche 6 年 前
コミット
e22e7e2252
No account linked to committer's email address
共有7 個のファイルを変更した39 個の追加12 個の削除を含む
  1. 21
    11
      docs/Reference.md
  2. 1
    0
      ios/RNCWKWebView.h
  3. 1
    0
      ios/RNCWKWebView.m
  4. 1
    0
      ios/RNCWKWebViewManager.m
  5. 9
    0
      js/WebView.ios.js
  6. 5
    0
      js/WebViewTypes.js
  7. 1
    1
      package.json

+ 21
- 11
docs/Reference.md ファイルの表示

8
 
8
 
9
 - [`source`](Reference.md#source)
9
 - [`source`](Reference.md#source)
10
 - [`automaticallyAdjustContentInsets`](Reference.md#automaticallyadjustcontentinsets)
10
 - [`automaticallyAdjustContentInsets`](Reference.md#automaticallyadjustcontentinsets)
11
-- [`injectJavaScript`](Reference.md#injectjavascript)
12
 - [`injectedJavaScript`](Reference.md#injectedjavascript)
11
 - [`injectedJavaScript`](Reference.md#injectedjavascript)
13
 - [`mediaPlaybackRequiresUserAction`](Reference.md#mediaplaybackrequiresuseraction)
12
 - [`mediaPlaybackRequiresUserAction`](Reference.md#mediaplaybackrequiresuseraction)
14
 - [`nativeConfig`](Reference.md#nativeconfig)
13
 - [`nativeConfig`](Reference.md#nativeconfig)
44
 - [`url`](Reference.md#url)
43
 - [`url`](Reference.md#url)
45
 - [`html`](Reference.md#html)
44
 - [`html`](Reference.md#html)
46
 - [`hideKeyboardAccessoryView`](Reference.md#hidekeyboardaccessoryview)
45
 - [`hideKeyboardAccessoryView`](Reference.md#hidekeyboardaccessoryview)
46
+- [`allowsBackForwardNavigationGestures`](Reference.md#allowsbackforwardnavigationgestures)
47
 
47
 
48
 ## Methods Index
48
 ## Methods Index
49
 
49
 
52
 - [`goBack`](Reference.md#goback)
52
 - [`goBack`](Reference.md#goback)
53
 - [`reload`](Reference.md#reload)
53
 - [`reload`](Reference.md#reload)
54
 - [`stopLoading`](Reference.md#stoploading)
54
 - [`stopLoading`](Reference.md#stoploading)
55
+- [`injectJavaScript`](Reference.md#injectjavascriptstr)
55
 
56
 
56
 ---
57
 ---
57
 
58
 
95
 
96
 
96
 ---
97
 ---
97
 
98
 
98
-### `injectJavaScript`
99
-
100
-Function that accepts a string that will be passed to the WebView and executed immediately as JavaScript.
101
-
102
-| Type     | Required |
103
-| -------- | -------- |
104
-| function | No       |
105
-
106
----
107
-
108
 ### `injectedJavaScript`
99
 ### `injectedJavaScript`
109
 
100
 
110
 Set this to provide JavaScript that will be injected into the web page when the view loads.
101
 Set this to provide JavaScript that will be injected into the web page when the view loads.
494
 | ------- | -------- | -------- |
485
 | ------- | -------- | -------- |
495
 | boolean | No       | iOS      |
486
 | boolean | No       | iOS      |
496
 
487
 
488
+---
489
+
490
+### `allowsBackForwardNavigationGestures`
491
+
492
+If true, this will be able horizontal swipe gestures when using the WKWebView. The default value is `false`.
493
+
494
+| Type    | Required | Platform |
495
+| ------- | -------- | -------- |
496
+| boolean | No       | iOS      |
497
+
498
+
497
 ## Methods
499
 ## Methods
498
 
500
 
499
 ### `extraNativeComponentConfig()`
501
 ### `extraNativeComponentConfig()`
534
 
536
 
535
 Stop loading the current page.
537
 Stop loading the current page.
536
 
538
 
539
+### `injectJavaScript(str)`
540
+
541
+```javascript
542
+injectJavaScript("... javascript string ...");
543
+```
544
+
545
+Executes the JavaScript string.
546
+
537
 ## Other Docs
547
 ## Other Docs
538
 
548
 
539
 Also check out our [Getting Started Guide](Getting-Started.md) and [In-Depth Guide](Guide.md).
549
 Also check out our [Getting Started Guide](Getting-Started.md) and [In-Depth Guide](Guide.md).

+ 1
- 0
ios/RNCWKWebView.h ファイルの表示

36
 @property (nonatomic, assign) UIEdgeInsets contentInset;
36
 @property (nonatomic, assign) UIEdgeInsets contentInset;
37
 @property (nonatomic, assign) BOOL automaticallyAdjustContentInsets;
37
 @property (nonatomic, assign) BOOL automaticallyAdjustContentInsets;
38
 @property (nonatomic, assign) BOOL hideKeyboardAccessoryView;
38
 @property (nonatomic, assign) BOOL hideKeyboardAccessoryView;
39
+@property (nonatomic, assign) BOOL allowsBackForwardNavigationGestures;
39
 
40
 
40
 - (void)postMessage:(NSString *)message;
41
 - (void)postMessage:(NSString *)message;
41
 - (void)injectJavaScript:(NSString *)script;
42
 - (void)injectJavaScript:(NSString *)script;

+ 1
- 0
ios/RNCWKWebView.m ファイルの表示

102
     _webView.scrollView.scrollEnabled = _scrollEnabled;
102
     _webView.scrollView.scrollEnabled = _scrollEnabled;
103
     _webView.scrollView.bounces = _bounces;
103
     _webView.scrollView.bounces = _bounces;
104
     [_webView addObserver:self forKeyPath:@"estimatedProgress" options:NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew context:nil];
104
     [_webView addObserver:self forKeyPath:@"estimatedProgress" options:NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew context:nil];
105
+    _webView.allowsBackForwardNavigationGestures = _allowsBackForwardNavigationGestures;
105
 
106
 
106
 #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */
107
 #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */
107
     if ([_webView.scrollView respondsToSelector:@selector(setContentInsetAdjustmentBehavior:)]) {
108
     if ([_webView.scrollView respondsToSelector:@selector(setContentInsetAdjustmentBehavior:)]) {

+ 1
- 0
ios/RNCWKWebViewManager.m ファイルの表示

44
 RCT_EXPORT_VIEW_PROPERTY(contentInset, UIEdgeInsets)
44
 RCT_EXPORT_VIEW_PROPERTY(contentInset, UIEdgeInsets)
45
 RCT_EXPORT_VIEW_PROPERTY(automaticallyAdjustContentInsets, BOOL)
45
 RCT_EXPORT_VIEW_PROPERTY(automaticallyAdjustContentInsets, BOOL)
46
 RCT_EXPORT_VIEW_PROPERTY(hideKeyboardAccessoryView, BOOL)
46
 RCT_EXPORT_VIEW_PROPERTY(hideKeyboardAccessoryView, BOOL)
47
+RCT_EXPORT_VIEW_PROPERTY(allowsBackForwardNavigationGestures, BOOL)
47
 
48
 
48
 /**
49
 /**
49
  * Expose methods to enable messaging the webview.
50
  * Expose methods to enable messaging the webview.

+ 9
- 0
js/WebView.ios.js ファイルの表示

151
         'The scalesPageToFit property is not supported when useWebKit = true',
151
         'The scalesPageToFit property is not supported when useWebKit = true',
152
       );
152
       );
153
     }
153
     }
154
+    if (
155
+      !this.props.useWebKit &&
156
+      this.props.allowsBackForwardNavigationGestures
157
+    ) {
158
+      console.warn(
159
+        'The allowsBackForwardNavigationGestures property is not supported when useWebKit = false',
160
+      );
161
+    }
154
   }
162
   }
155
 
163
 
156
   render() {
164
   render() {
262
           this.props.automaticallyAdjustContentInsets
270
           this.props.automaticallyAdjustContentInsets
263
         }
271
         }
264
         hideKeyboardAccessoryView={this.props.hideKeyboardAccessoryView}
272
         hideKeyboardAccessoryView={this.props.hideKeyboardAccessoryView}
273
+        allowsBackForwardNavigationGestures={this.props.allowsBackForwardNavigationGestures}
265
         onLoadingStart={this._onLoadingStart}
274
         onLoadingStart={this._onLoadingStart}
266
         onLoadingFinish={this._onLoadingFinish}
275
         onLoadingFinish={this._onLoadingFinish}
267
         onLoadingError={this._onLoadingError}
276
         onLoadingError={this._onLoadingError}

+ 5
- 0
js/WebViewTypes.js ファイルの表示

224
    * backward compatible.
224
    * backward compatible.
225
    */
225
    */
226
   hideKeyboardAccessoryView?: ?boolean,
226
   hideKeyboardAccessoryView?: ?boolean,
227
+  /**
228
+   * A Boolean value indicating whether horizontal swipe gestures will trigger
229
+   * back-forward list navigations.
230
+   */
231
+  allowsBackForwardNavigationGestures?: ?boolean,
227
 |}>;
232
 |}>;
228
 
233
 
229
 export type AndroidWebViewProps = $ReadOnly<{|
234
 export type AndroidWebViewProps = $ReadOnly<{|

+ 1
- 1
package.json ファイルの表示

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