Thibault Malbranche hace 6 años
padre
commit
0e34982477

+ 1
- 1
android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java Ver fichero

@@ -518,7 +518,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
518 518
         }
519 519
         if (source.hasKey("method")) {
520 520
           String method = source.getString("method");
521
-          if (method.equals(HTTP_METHOD_POST)) {
521
+          if (method.equalsIgnoreCase(HTTP_METHOD_POST)) {
522 522
             byte[] postData = null;
523 523
             if (source.hasKey("body")) {
524 524
               String body = source.getString("body");

+ 7
- 8
js/WebView.ios.js Ver fichero

@@ -8,11 +8,7 @@
8 8
  * @flow
9 9
  */
10 10
 
11
-'use strict';
12
-
13 11
 import React from 'react';
14
-
15
-import ReactNative from 'react-native'
16 12
 import {
17 13
   ActivityIndicator,
18 14
   Linking,
@@ -22,7 +18,8 @@ import {
22 18
   View,
23 19
   requireNativeComponent,
24 20
   NativeModules,
25
-  Image
21
+  Image,
22
+  findNodeHandle,
26 23
 } from 'react-native';
27 24
 
28 25
 import invariant from 'fbjs/lib/invariant';
@@ -136,7 +133,9 @@ class WebView extends React.Component<WebViewSharedProps, State> {
136 133
   };
137 134
 
138 135
   state = {
139
-    viewState: this.props.startInLoadingState ? WebViewState.LOADING : WebViewState.IDLE,
136
+    viewState: this.props.startInLoadingState
137
+      ? WebViewState.LOADING
138
+      : WebViewState.IDLE,
140 139
     lastErrorEvent: null,
141 140
   };
142 141
 
@@ -203,7 +202,7 @@ class WebView extends React.Component<WebViewSharedProps, State> {
203 202
       'about:blank',
204 203
       ...(this.props.originWhitelist || []),
205 204
     ].map(WebViewShared.originWhitelistToRegex);
206
-    const onShouldStartLoadWithRequest = (event) => {
205
+    const onShouldStartLoadWithRequest = event => {
207 206
       let shouldStart = true;
208 207
       const { url } = event.nativeEvent;
209 208
       const origin = WebViewShared.extractOrigin(url);
@@ -384,7 +383,7 @@ class WebView extends React.Component<WebViewSharedProps, State> {
384 383
    * Returns the native `WebView` node.
385 384
    */
386 385
   getWebViewHandle = () => {
387
-    return ReactNative.findNodeHandle(this.webViewRef.current);
386
+    return findNodeHandle(this.webViewRef.current);
388 387
   };
389 388
 
390 389
   _onLoadingStart = (event: WebViewNavigationEvent) => {

+ 2
- 2
js/WebViewShared.js Ver fichero

@@ -14,11 +14,11 @@ const escapeStringRegexp = require('escape-string-regexp');
14 14
 
15 15
 const WebViewShared = {
16 16
   defaultOriginWhitelist: ['http://*', 'https://*'],
17
-  extractOrigin: (url: string) => {
17
+  extractOrigin: (url: string): string => {
18 18
     const result = /^[A-Za-z0-9]+:(\/\/)?[^/]*/.exec(url);
19 19
     return result === null ? '' : result[0];
20 20
   },
21
-  originWhitelistToRegex: (originWhitelist: string) => {
21
+  originWhitelistToRegex: (originWhitelist: string): string => {
22 22
     return escapeStringRegexp(originWhitelist).replace(/\\\*/g, '.*');
23 23
   },
24 24
 };