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
       webViewStyles.push(styles.hidden);
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
     const NativeWebView
267
     const NativeWebView
280
 
276
 
281
     const webView = (
277
     const webView = (
282
       <NativeWebView
278
       <NativeWebView
283
-        {...otherProps}
284
         key="webViewKey"
279
         key="webViewKey"
280
+        {...otherProps}
285
         messagingEnabled={typeof onMessage === 'function'}
281
         messagingEnabled={typeof onMessage === 'function'}
286
         onLoadingError={this.onLoadingError}
282
         onLoadingError={this.onLoadingError}
287
         onLoadingFinish={this.onLoadingFinish}
283
         onLoadingFinish={this.onLoadingFinish}

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

391
 
391
 
392
     const webView = (
392
     const webView = (
393
       <NativeWebView
393
       <NativeWebView
394
+        key="webViewKey"
394
         {...otherProps}
395
         {...otherProps}
395
         decelerationRate={decelerationRate}
396
         decelerationRate={decelerationRate}
396
-        key="webViewKey"
397
         messagingEnabled={typeof onMessage === 'function'}
397
         messagingEnabled={typeof onMessage === 'function'}
398
         onLoadingError={this.onLoadingError}
398
         onLoadingError={this.onLoadingError}
399
         onLoadingFinish={this.onLoadingFinish}
399
         onLoadingFinish={this.onLoadingFinish}

+ 0
- 4
src/WebViewTypes.ts View File

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