Thibault Malbranche 5 years ago
parent
commit
0e34982477

+ 1
- 1
android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java View File

518
         }
518
         }
519
         if (source.hasKey("method")) {
519
         if (source.hasKey("method")) {
520
           String method = source.getString("method");
520
           String method = source.getString("method");
521
-          if (method.equals(HTTP_METHOD_POST)) {
521
+          if (method.equalsIgnoreCase(HTTP_METHOD_POST)) {
522
             byte[] postData = null;
522
             byte[] postData = null;
523
             if (source.hasKey("body")) {
523
             if (source.hasKey("body")) {
524
               String body = source.getString("body");
524
               String body = source.getString("body");

+ 7
- 8
js/WebView.ios.js View File

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

+ 2
- 2
js/WebViewShared.js View File

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