Browse Source

iOS Webview now using local RNCWebView

Jamon Holmgren 6 years ago
parent
commit
bd2c3bc8c2
3 changed files with 6 additions and 6 deletions
  1. 2
    2
      ios/RNCWebView.h
  2. 3
    3
      ios/RNCWebView.m
  3. 1
    1
      js/WebView.ios.js

+ 2
- 2
ios/RNCWebView.h View File

13
  * Special scheme used to pass messages to the injectedJavaScript
13
  * Special scheme used to pass messages to the injectedJavaScript
14
  * code without triggering a page load. Usage:
14
  * code without triggering a page load. Usage:
15
  *
15
  *
16
- *   window.location.href = RCTJSNavigationScheme + '://hello'
16
+ *   window.location.href = RNCJSNavigationScheme + '://hello'
17
  */
17
  */
18
-extern NSString *const RCTJSNavigationScheme;
18
+extern NSString *const RNCJSNavigationScheme;
19
 
19
 
20
 @protocol RNCWebViewDelegate <NSObject>
20
 @protocol RNCWebViewDelegate <NSObject>
21
 
21
 

+ 3
- 3
ios/RNCWebView.m View File

16
 #import <React/RCTView.h>
16
 #import <React/RCTView.h>
17
 #import <React/UIView+React.h>
17
 #import <React/UIView+React.h>
18
 
18
 
19
-NSString *const RCTJSNavigationScheme = @"react-js-navigation";
19
+NSString *const RNCJSNavigationScheme = @"react-js-navigation";
20
 
20
 
21
 static NSString *const kPostMessageHost = @"postMessage";
21
 static NSString *const kPostMessageHost = @"postMessage";
22
 
22
 
201
 - (BOOL)webView:(__unused UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request
201
 - (BOOL)webView:(__unused UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request
202
  navigationType:(UIWebViewNavigationType)navigationType
202
  navigationType:(UIWebViewNavigationType)navigationType
203
 {
203
 {
204
-  BOOL isJSNavigation = [request.URL.scheme isEqualToString:RCTJSNavigationScheme];
204
+  BOOL isJSNavigation = [request.URL.scheme isEqualToString:RNCJSNavigationScheme];
205
 
205
 
206
   static NSDictionary<NSNumber *, NSString *> *navigationTypes;
206
   static NSDictionary<NSNumber *, NSString *> *navigationTypes;
207
   static dispatch_once_t onceToken;
207
   static dispatch_once_t onceToken;
329
           "messagePending = false;"
329
           "messagePending = false;"
330
           "processQueue();"
330
           "processQueue();"
331
         "});"
331
         "});"
332
-      "})();", RCTJSNavigationScheme, kPostMessageHost
332
+      "})();", RNCJSNavigationScheme, kPostMessageHost
333
     ];
333
     ];
334
     [webView stringByEvaluatingJavaScriptFromString:source];
334
     [webView stringByEvaluatingJavaScriptFromString:source];
335
   }
335
   }

+ 1
- 1
js/WebView.ios.js View File

49
 }
49
 }
50
 
50
 
51
 
51
 
52
-// const RNCWebViewManager = NativeModules.WebViewManager;
52
+const RNCWebViewManager = NativeModules.WebViewManager;
53
 
53
 
54
 const BGWASH = 'rgba(255,255,255,0.8)';
54
 const BGWASH = 'rgba(255,255,255,0.8)';
55
 const RCT_WEBVIEW_REF = 'webview';
55
 const RCT_WEBVIEW_REF = 'webview';