Browse Source

last test

Thibault Malbranche 5 years ago
parent
commit
96334d31ed
3 changed files with 10 additions and 18 deletions
  1. 9
    13
      src/WebView.android.tsx
  2. 1
    1
      src/WebView.ios.tsx
  3. 0
    4
      src/WebViewTypes.ts

+ 9
- 13
src/WebView.android.tsx View File

@@ -254,18 +254,14 @@ class WebView extends React.Component<AndroidWebViewProps, State> {
254 254
       webViewStyles.push(styles.hidden);
255 255
     }
256 256
 
257
-    if (
258
-      (source as WebViewUriSource).method === 'POST'
259
-      && (source as WebViewUriSource).headers
260
-    ) {
261
-      console.warn(
262
-        'WebView: `source.headers` is not supported when using POST.',
263
-      );
264
-    } else if (
265
-      (source as WebViewUriSource).method === 'GET'
266
-      && (source as WebViewUriSource).body
267
-    ) {
268
-      console.warn('WebView: `source.body` is not supported when using GET.');
257
+    if (source && 'method' in source) {
258
+      if (source.method === 'POST' && source.headers) {
259
+        console.warn(
260
+          'WebView: `source.headers` is not supported when using POST.',
261
+        );
262
+      } else if (source.method === 'GET' && source.body) {
263
+        console.warn('WebView: `source.body` is not supported when using GET.');
264
+      }
269 265
     }
270 266
 
271 267
     const NativeWebView
@@ -280,8 +276,8 @@ class WebView extends React.Component<AndroidWebViewProps, State> {
280 276
 
281 277
     const webView = (
282 278
       <NativeWebView
283
-        {...otherProps}
284 279
         key="webViewKey"
280
+        {...otherProps}
285 281
         messagingEnabled={typeof onMessage === 'function'}
286 282
         onLoadingError={this.onLoadingError}
287 283
         onLoadingFinish={this.onLoadingFinish}

+ 1
- 1
src/WebView.ios.tsx View File

@@ -391,9 +391,9 @@ class WebView extends React.Component<IOSWebViewProps, State> {
391 391
 
392 392
     const webView = (
393 393
       <NativeWebView
394
+        key="webViewKey"
394 395
         {...otherProps}
395 396
         decelerationRate={decelerationRate}
396
-        key="webViewKey"
397 397
         messagingEnabled={typeof onMessage === 'function'}
398 398
         onLoadingError={this.onLoadingError}
399 399
         onLoadingFinish={this.onLoadingFinish}

+ 0
- 4
src/WebViewTypes.ts View File

@@ -3,9 +3,7 @@
3 3
 import { ReactElement, Component } from 'react';
4 4
 import {
5 5
   NativeSyntheticEvent,
6
-  ViewStyle,
7 6
   ViewProps,
8
-  StyleProp,
9 7
   NativeMethodsMixin,
10 8
   Constructor,
11 9
   UIManagerStatic,
@@ -619,6 +617,4 @@ export interface WebViewSharedProps extends ViewProps {
619 617
    * Should caching be enabled. Default is true.
620 618
    */
621 619
   cacheEnabled?: boolean;
622
-
623
-  style?: StyleProp<ViewStyle>;
624 620
 }