Parcourir la source

got `react-native run-android` working again.

Tom Underhill il y a 5 ans
Parent
révision
528128ed4d
2 fichiers modifiés avec 13 ajouts et 12 suppressions
  1. 1
    0
      package.json
  2. 12
    12
      src/WebView.macos.tsx

+ 1
- 0
package.json Voir le fichier

38
     "@babel/core": "7.4.5",
38
     "@babel/core": "7.4.5",
39
     "@babel/runtime": "7.4.5",
39
     "@babel/runtime": "7.4.5",
40
     "@react-native-community/cli-platform-ios": "^3.0.0",
40
     "@react-native-community/cli-platform-ios": "^3.0.0",
41
+    "@react-native-community/cli-platform-android": "^3.0.0",
41
     "@semantic-release/git": "7.0.16",
42
     "@semantic-release/git": "7.0.16",
42
     "@types/invariant": "^2.2.30",
43
     "@types/invariant": "^2.2.30",
43
     "@types/jest": "24.0.18",
44
     "@types/jest": "24.0.18",

+ 12
- 12
src/WebView.macos.tsx Voir le fichier

23
   WebViewNavigationEvent,
23
   WebViewNavigationEvent,
24
   WebViewProgressEvent,
24
   WebViewProgressEvent,
25
   WebViewTerminatedEvent,
25
   WebViewTerminatedEvent,
26
-  IOSWebViewProps,
26
+  MacOSWebViewProps,
27
   DecelerationRateConstant,
27
   DecelerationRateConstant,
28
-  NativeWebViewIOS,
28
+  NativeWebViewMacOS,
29
   ViewManager,
29
   ViewManager,
30
   State,
30
   State,
31
-  RNCWebViewUIManagerIOS,
31
+  RNCWebViewUIManagerMacOS,
32
 } from './WebViewTypes';
32
 } from './WebViewTypes';
33
 
33
 
34
 import styles from './WebView.styles';
34
 import styles from './WebView.styles';
35
 
35
 
36
-const UIManager = NotTypedUIManager as RNCWebViewUIManagerIOS;
36
+const UIManager = NotTypedUIManager as RNCWebViewUIManagerMacOS;
37
 
37
 
38
 const { resolveAssetSource } = Image;
38
 const { resolveAssetSource } = Image;
39
 const processDecelerationRate = (
39
 const processDecelerationRate = (
50
 
50
 
51
 const RNCWebViewManager = NativeModules.RNCWebViewManager as ViewManager;
51
 const RNCWebViewManager = NativeModules.RNCWebViewManager as ViewManager;
52
 
52
 
53
-const RNCWebView: typeof NativeWebViewIOS = requireNativeComponent(
53
+const RNCWebView: typeof NativeWebViewMacOS = requireNativeComponent(
54
   'RNCWebView',
54
   'RNCWebView',
55
 );
55
 );
56
 
56
 
57
-class WebView extends React.Component<IOSWebViewProps, State> {
57
+class WebView extends React.Component<MacOSWebViewProps, State> {
58
   static defaultProps = {
58
   static defaultProps = {
59
     javaScriptEnabled: true,
59
     javaScriptEnabled: true,
60
     cacheEnabled: true,
60
     cacheEnabled: true,
63
   };
63
   };
64
 
64
 
65
   static isFileUploadSupported = async () => {
65
   static isFileUploadSupported = async () => {
66
-    // no native implementation for iOS, depends only on permissions
66
+    // no native implementation for macOS, depends only on permissions
67
     return true;
67
     return true;
68
   };
68
   };
69
 
69
 
72
     lastErrorEvent: null,
72
     lastErrorEvent: null,
73
   };
73
   };
74
 
74
 
75
-  webViewRef = React.createRef<NativeWebViewIOS>();
75
+  webViewRef = React.createRef<NativeWebViewMacOS>();
76
 
76
 
77
   // eslint-disable-next-line react/sort-comp
77
   // eslint-disable-next-line react/sort-comp
78
   getCommands = () => UIManager.getViewManagerConfig('RNCWebView').Commands;
78
   getCommands = () => UIManager.getViewManagerConfig('RNCWebView').Commands;
263
     }
263
     }
264
   };
264
   };
265
 
265
 
266
-  componentDidUpdate(prevProps: IOSWebViewProps) {
266
+  componentDidUpdate(prevProps: MacOSWebViewProps) {
267
     this.showRedboxOnPropChanges(prevProps, 'allowsInlineMediaPlayback');
267
     this.showRedboxOnPropChanges(prevProps, 'allowsInlineMediaPlayback');
268
     this.showRedboxOnPropChanges(prevProps, 'incognito');
268
     this.showRedboxOnPropChanges(prevProps, 'incognito');
269
     this.showRedboxOnPropChanges(prevProps, 'mediaPlaybackRequiresUserAction');
269
     this.showRedboxOnPropChanges(prevProps, 'mediaPlaybackRequiresUserAction');
271
   }
271
   }
272
 
272
 
273
   showRedboxOnPropChanges(
273
   showRedboxOnPropChanges(
274
-    prevProps: IOSWebViewProps,
275
-    propName: keyof IOSWebViewProps,
274
+    prevProps: MacOSWebViewProps,
275
+    propName: keyof MacOSWebViewProps,
276
   ) {
276
   ) {
277
     if (this.props[propName] !== prevProps[propName]) {
277
     if (this.props[propName] !== prevProps[propName]) {
278
       console.error(
278
       console.error(
326
     const decelerationRate = processDecelerationRate(decelerationRateProp);
326
     const decelerationRate = processDecelerationRate(decelerationRateProp);
327
 
327
 
328
     const NativeWebView
328
     const NativeWebView
329
-      = (nativeConfig.component as typeof NativeWebViewIOS | undefined)
329
+      = (nativeConfig.component as typeof NativeWebViewMacOS | undefined)
330
       || RNCWebView;
330
       || RNCWebView;
331
 
331
 
332
     const webView = (
332
     const webView = (