Browse Source

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

Tom Underhill 4 years ago
parent
commit
528128ed4d
2 changed files with 13 additions and 12 deletions
  1. 1
    0
      package.json
  2. 12
    12
      src/WebView.macos.tsx

+ 1
- 0
package.json View File

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

+ 12
- 12
src/WebView.macos.tsx View File

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