Sfoglia il codice sorgente

Added RNCWebViewManager to xcode proj

Jamon Holmgren 5 anni fa
parent
commit
52ba380e4a

+ 2
- 2
android/src/main/java/com/infinitered/webview/ReactWebViewManager.java Vedi File

1
 /**
1
 /**
2
- * Copyright (c) 2015-present, Facebook, Inc.
2
+ * Copyright (c) 2018-present, Infinite Red, Inc.
3
  *
3
  *
4
  * This source code is licensed under the MIT license found in the
4
  * This source code is licensed under the MIT license found in the
5
  * LICENSE file in the root directory of this source tree.
5
  * LICENSE file in the root directory of this source tree.
93
 @ReactModule(name = ReactWebViewManager.REACT_CLASS)
93
 @ReactModule(name = ReactWebViewManager.REACT_CLASS)
94
 public class ReactWebViewManager extends SimpleViewManager<WebView> {
94
 public class ReactWebViewManager extends SimpleViewManager<WebView> {
95
 
95
 
96
-  protected static final String REACT_CLASS = "RCTWebView";
96
+  protected static final String REACT_CLASS = "RNCWebView";
97
 
97
 
98
   protected static final String HTML_ENCODING = "UTF-8";
98
   protected static final String HTML_ENCODING = "UTF-8";
99
   protected static final String HTML_MIME_TYPE = "text/html";
99
   protected static final String HTML_MIME_TYPE = "text/html";

+ 1
- 1
android/src/main/java/com/infinitered/webview/WebViewConfig.java Vedi File

1
 /**
1
 /**
2
- * Copyright (c) 2015-present, Facebook, Inc.
2
+ * Copyright (c) 2018-present, Infinite Red, Inc.
3
  *
3
  *
4
  * This source code is licensed under the MIT license found in the
4
  * This source code is licensed under the MIT license found in the
5
  * LICENSE file in the root directory of this source tree.
5
  * LICENSE file in the root directory of this source tree.

+ 1
- 1
android/src/main/java/com/infinitered/webview/events/TopLoadingErrorEvent.java Vedi File

1
 /**
1
 /**
2
- * Copyright (c) 2015-present, Facebook, Inc.
2
+ * Copyright (c) 2018-present, Infinite Red, Inc.
3
  *
3
  *
4
  * This source code is licensed under the MIT license found in the
4
  * This source code is licensed under the MIT license found in the
5
  * LICENSE file in the root directory of this source tree.
5
  * LICENSE file in the root directory of this source tree.

+ 1
- 1
android/src/main/java/com/infinitered/webview/events/TopLoadingFinishEvent.java Vedi File

1
 /**
1
 /**
2
- * Copyright (c) 2015-present, Facebook, Inc.
2
+ * Copyright (c) 2018-present, Infinite Red, Inc.
3
  *
3
  *
4
  * This source code is licensed under the MIT license found in the
4
  * This source code is licensed under the MIT license found in the
5
  * LICENSE file in the root directory of this source tree.
5
  * LICENSE file in the root directory of this source tree.

+ 1
- 1
android/src/main/java/com/infinitered/webview/events/TopLoadingStartEvent.java Vedi File

1
 /**
1
 /**
2
- * Copyright (c) 2015-present, Facebook, Inc.
2
+ * Copyright (c) 2018-present, Infinite Red, Inc.
3
  *
3
  *
4
  * This source code is licensed under the MIT license found in the
4
  * This source code is licensed under the MIT license found in the
5
  * LICENSE file in the root directory of this source tree.
5
  * LICENSE file in the root directory of this source tree.

+ 1
- 1
android/src/main/java/com/infinitered/webview/events/TopMessageEvent.java Vedi File

1
 /**
1
 /**
2
- * Copyright (c) 2015-present, Facebook, Inc.
2
+ * Copyright (c) 2018-present, Infinite Red, Inc.
3
  *
3
  *
4
  * This source code is licensed under the MIT license found in the
4
  * This source code is licensed under the MIT license found in the
5
  * LICENSE file in the root directory of this source tree.
5
  * LICENSE file in the root directory of this source tree.

+ 1
- 1
examples/WebViewExample.js Vedi File

1
 /**
1
 /**
2
- * Copyright (c) 2015-present, Facebook, Inc.
2
+ * Copyright (c) 2018-present, Infinite Red, Inc.
3
  *
3
  *
4
  * This source code is licensed under the MIT license found in the
4
  * This source code is licensed under the MIT license found in the
5
  * LICENSE file in the root directory of this source tree.
5
  * LICENSE file in the root directory of this source tree.

+ 1
- 1
examples/XHRExampleCookies.js Vedi File

1
 /**
1
 /**
2
- * Copyright (c) 2015-present, Facebook, Inc.
2
+ * Copyright (c) 2018-present, Infinite Red, Inc.
3
  *
3
  *
4
  * This source code is licensed under the MIT license found in the
4
  * This source code is licensed under the MIT license found in the
5
  * LICENSE file in the root directory of this source tree.
5
  * LICENSE file in the root directory of this source tree.

+ 1
- 1
index.js Vedi File

1
-import WebView from './src/js/WebView';
1
+import WebView from './js/WebView';
2
 
2
 
3
 export { WebView };
3
 export { WebView };

ios/RCTWebView.h → ios/RNCWebView.h Vedi File

1
 /**
1
 /**
2
- * Copyright (c) 2015-present, Facebook, Inc.
2
+ * Copyright (c) 2018-present, Infinite Red, Inc.
3
  *
3
  *
4
  * This source code is licensed under the MIT license found in the
4
  * This source code is licensed under the MIT license found in the
5
  * LICENSE file in the root directory of this source tree.
5
  * LICENSE file in the root directory of this source tree.
7
 
7
 
8
 #import <React/RCTView.h>
8
 #import <React/RCTView.h>
9
 
9
 
10
-@class RCTWebView;
10
+@class RNCWebView;
11
 
11
 
12
 /**
12
 /**
13
  * Special scheme used to pass messages to the injectedJavaScript
13
  * Special scheme used to pass messages to the injectedJavaScript
17
  */
17
  */
18
 extern NSString *const RCTJSNavigationScheme;
18
 extern NSString *const RCTJSNavigationScheme;
19
 
19
 
20
-@protocol RCTWebViewDelegate <NSObject>
20
+@protocol RNCWebViewDelegate <NSObject>
21
 
21
 
22
-- (BOOL)webView:(RCTWebView *)webView
22
+- (BOOL)webView:(RNCWebView *)webView
23
 shouldStartLoadForRequest:(NSMutableDictionary<NSString *, id> *)request
23
 shouldStartLoadForRequest:(NSMutableDictionary<NSString *, id> *)request
24
    withCallback:(RCTDirectEventBlock)callback;
24
    withCallback:(RCTDirectEventBlock)callback;
25
 
25
 
26
 @end
26
 @end
27
 
27
 
28
-@interface RCTWebView : RCTView
28
+@interface RNCWebView : RCTView
29
 
29
 
30
-@property (nonatomic, weak) id<RCTWebViewDelegate> delegate;
30
+@property (nonatomic, weak) id<RNCWebViewDelegate> delegate;
31
 
31
 
32
 @property (nonatomic, copy) NSDictionary *source;
32
 @property (nonatomic, copy) NSDictionary *source;
33
 @property (nonatomic, assign) UIEdgeInsets contentInset;
33
 @property (nonatomic, assign) UIEdgeInsets contentInset;

ios/RCTWebView.m → ios/RNCWebView.m Vedi File

1
 /**
1
 /**
2
- * Copyright (c) 2015-present, Facebook, Inc.
2
+ * Copyright (c) 2018-present, Infinite Red, Inc.
3
  *
3
  *
4
  * This source code is licensed under the MIT license found in the
4
  * This source code is licensed under the MIT license found in the
5
  * LICENSE file in the root directory of this source tree.
5
  * LICENSE file in the root directory of this source tree.
6
  */
6
  */
7
 
7
 
8
-#import "RCTWebView.h"
8
+#import "RNCWebView.h"
9
 
9
 
10
-#import <UIKit/UIKit.h>
11
-
12
-#import "RCTAutoInsetsProtocol.h"
13
-#import "RCTConvert.h"
14
-#import "RCTEventDispatcher.h"
15
-#import "RCTLog.h"
16
-#import "RCTUtils.h"
17
-#import "RCTView.h"
18
-#import "UIView+React.h"
10
+// #import <UIKit/UIKit.h>
11
+#import <React/RCTAutoInsetsProtocol.h>
12
+#import <React/RCTConvert.h>
13
+#import <React/RCTEventDispatcher.h>
14
+#import <React/RCTLog.h>
15
+#import <React/RCTUtils.h>
16
+#import <React/RCTView.h>
17
+#import <React/UIView+React.h>
19
 
18
 
20
 NSString *const RCTJSNavigationScheme = @"react-js-navigation";
19
 NSString *const RCTJSNavigationScheme = @"react-js-navigation";
21
 
20
 
22
 static NSString *const kPostMessageHost = @"postMessage";
21
 static NSString *const kPostMessageHost = @"postMessage";
23
 
22
 
24
-@interface RCTWebView () <UIWebViewDelegate, RCTAutoInsetsProtocol>
23
+@interface RNCWebView () <UIWebViewDelegate, RCTAutoInsetsProtocol>
25
 
24
 
26
 @property (nonatomic, copy) RCTDirectEventBlock onLoadingStart;
25
 @property (nonatomic, copy) RCTDirectEventBlock onLoadingStart;
27
 @property (nonatomic, copy) RCTDirectEventBlock onLoadingFinish;
26
 @property (nonatomic, copy) RCTDirectEventBlock onLoadingFinish;
31
 
30
 
32
 @end
31
 @end
33
 
32
 
34
-@implementation RCTWebView
33
+@implementation RNCWebView
35
 {
34
 {
36
   UIWebView *_webView;
35
   UIWebView *_webView;
37
   NSString *_injectedJavaScript;
36
   NSString *_injectedJavaScript;

ios/RCTWebView.podspec → ios/RNCWebView.podspec Vedi File

1
 
1
 
2
 Pod::Spec.new do |s|
2
 Pod::Spec.new do |s|
3
-  s.name         = "RCTWebView"
3
+  s.name         = "RNCWebView"
4
   s.version      = "1.0.0"
4
   s.version      = "1.0.0"
5
-  s.summary      = "RCTWebView"
5
+  s.summary      = "RNCWebView"
6
   s.description  = <<-DESC
6
   s.description  = <<-DESC
7
-                  RCTWebView
7
+                  RNCWebView
8
                    DESC
8
                    DESC
9
   s.homepage     = ""
9
   s.homepage     = ""
10
   s.license      = "MIT"
10
   s.license      = "MIT"
11
   # s.license      = { :type => "MIT", :file => "FILE_LICENSE" }
11
   # s.license      = { :type => "MIT", :file => "FILE_LICENSE" }
12
   s.author             = { "author" => "author@domain.cn" }
12
   s.author             = { "author" => "author@domain.cn" }
13
   s.platform     = :ios, "7.0"
13
   s.platform     = :ios, "7.0"
14
-  s.source       = { :git => "https://github.com/author/RCTWebView.git", :tag => "master" }
15
-  s.source_files  = "RCTWebView/**/*.{h,m}"
14
+  s.source       = { :git => "https://github.com/author/RNCWebView.git", :tag => "master" }
15
+  s.source_files  = "RNCWebView/**/*.{h,m}"
16
   s.requires_arc = true
16
   s.requires_arc = true
17
 
17
 
18
 
18
 

ios/RCTWebView.xcodeproj/project.pbxproj → ios/RNCWebView.xcodeproj/project.pbxproj Vedi File

7
 	objects = {
7
 	objects = {
8
 
8
 
9
 /* Begin PBXBuildFile section */
9
 /* Begin PBXBuildFile section */
10
-		B3E7B58A1CC2AC0600A0062D /* RCTWebView.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* RCTWebView.m */; };
10
+		B3E7B58A1CC2AC0600A0062D /* RNCWebView.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* RNCWebView.m */; };
11
+		E9C1776D21143306006210F8 /* RNCWebViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = E9C1776B21143306006210F8 /* RNCWebViewManager.m */; };
11
 /* End PBXBuildFile section */
12
 /* End PBXBuildFile section */
12
 
13
 
13
 /* Begin PBXCopyFilesBuildPhase section */
14
 /* Begin PBXCopyFilesBuildPhase section */
23
 /* End PBXCopyFilesBuildPhase section */
24
 /* End PBXCopyFilesBuildPhase section */
24
 
25
 
25
 /* Begin PBXFileReference section */
26
 /* Begin PBXFileReference section */
26
-		134814201AA4EA6300B7C361 /* libRCTWebView.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTWebView.a; sourceTree = BUILT_PRODUCTS_DIR; };
27
-		B3E7B5881CC2AC0600A0062D /* RCTWebView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTWebView.h; sourceTree = "<group>"; };
28
-		B3E7B5891CC2AC0600A0062D /* RCTWebView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTWebView.m; sourceTree = "<group>"; };
27
+		134814201AA4EA6300B7C361 /* libRNCWebView.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNCWebView.a; sourceTree = BUILT_PRODUCTS_DIR; };
28
+		B3E7B5881CC2AC0600A0062D /* RNCWebView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNCWebView.h; sourceTree = "<group>"; };
29
+		B3E7B5891CC2AC0600A0062D /* RNCWebView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNCWebView.m; sourceTree = "<group>"; };
30
+		E9C1776B21143306006210F8 /* RNCWebViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNCWebViewManager.m; sourceTree = "<group>"; };
31
+		E9C1776C21143306006210F8 /* RNCWebViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNCWebViewManager.h; sourceTree = "<group>"; };
29
 /* End PBXFileReference section */
32
 /* End PBXFileReference section */
30
 
33
 
31
 /* Begin PBXFrameworksBuildPhase section */
34
 /* Begin PBXFrameworksBuildPhase section */
42
 		134814211AA4EA7D00B7C361 /* Products */ = {
45
 		134814211AA4EA7D00B7C361 /* Products */ = {
43
 			isa = PBXGroup;
46
 			isa = PBXGroup;
44
 			children = (
47
 			children = (
45
-				134814201AA4EA6300B7C361 /* libRCTWebView.a */,
48
+				134814201AA4EA6300B7C361 /* libRNCWebView.a */,
46
 			);
49
 			);
47
 			name = Products;
50
 			name = Products;
48
 			sourceTree = "<group>";
51
 			sourceTree = "<group>";
50
 		58B511D21A9E6C8500147676 = {
53
 		58B511D21A9E6C8500147676 = {
51
 			isa = PBXGroup;
54
 			isa = PBXGroup;
52
 			children = (
55
 			children = (
53
-				B3E7B5881CC2AC0600A0062D /* RCTWebView.h */,
54
-				B3E7B5891CC2AC0600A0062D /* RCTWebView.m */,
56
+				E9C1776C21143306006210F8 /* RNCWebViewManager.h */,
57
+				E9C1776B21143306006210F8 /* RNCWebViewManager.m */,
58
+				B3E7B5881CC2AC0600A0062D /* RNCWebView.h */,
59
+				B3E7B5891CC2AC0600A0062D /* RNCWebView.m */,
55
 				134814211AA4EA7D00B7C361 /* Products */,
60
 				134814211AA4EA7D00B7C361 /* Products */,
56
 			);
61
 			);
57
 			sourceTree = "<group>";
62
 			sourceTree = "<group>";
59
 /* End PBXGroup section */
64
 /* End PBXGroup section */
60
 
65
 
61
 /* Begin PBXNativeTarget section */
66
 /* Begin PBXNativeTarget section */
62
-		58B511DA1A9E6C8500147676 /* RCTWebView */ = {
67
+		58B511DA1A9E6C8500147676 /* RNCWebView */ = {
63
 			isa = PBXNativeTarget;
68
 			isa = PBXNativeTarget;
64
-			buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RCTWebView" */;
69
+			buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNCWebView" */;
65
 			buildPhases = (
70
 			buildPhases = (
66
 				58B511D71A9E6C8500147676 /* Sources */,
71
 				58B511D71A9E6C8500147676 /* Sources */,
67
 				58B511D81A9E6C8500147676 /* Frameworks */,
72
 				58B511D81A9E6C8500147676 /* Frameworks */,
71
 			);
76
 			);
72
 			dependencies = (
77
 			dependencies = (
73
 			);
78
 			);
74
-			name = RCTWebView;
79
+			name = RNCWebView;
75
 			productName = RCTDataManager;
80
 			productName = RCTDataManager;
76
-			productReference = 134814201AA4EA6300B7C361 /* libRCTWebView.a */;
81
+			productReference = 134814201AA4EA6300B7C361 /* libRNCWebView.a */;
77
 			productType = "com.apple.product-type.library.static";
82
 			productType = "com.apple.product-type.library.static";
78
 		};
83
 		};
79
 /* End PBXNativeTarget section */
84
 /* End PBXNativeTarget section */
90
 					};
95
 					};
91
 				};
96
 				};
92
 			};
97
 			};
93
-			buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RCTWebView" */;
98
+			buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNCWebView" */;
94
 			compatibilityVersion = "Xcode 3.2";
99
 			compatibilityVersion = "Xcode 3.2";
95
 			developmentRegion = English;
100
 			developmentRegion = English;
96
 			hasScannedForEncodings = 0;
101
 			hasScannedForEncodings = 0;
102
 			projectDirPath = "";
107
 			projectDirPath = "";
103
 			projectRoot = "";
108
 			projectRoot = "";
104
 			targets = (
109
 			targets = (
105
-				58B511DA1A9E6C8500147676 /* RCTWebView */,
110
+				58B511DA1A9E6C8500147676 /* RNCWebView */,
106
 			);
111
 			);
107
 		};
112
 		};
108
 /* End PBXProject section */
113
 /* End PBXProject section */
112
 			isa = PBXSourcesBuildPhase;
117
 			isa = PBXSourcesBuildPhase;
113
 			buildActionMask = 2147483647;
118
 			buildActionMask = 2147483647;
114
 			files = (
119
 			files = (
115
-				B3E7B58A1CC2AC0600A0062D /* RCTWebView.m in Sources */,
120
+				B3E7B58A1CC2AC0600A0062D /* RNCWebView.m in Sources */,
121
+				E9C1776D21143306006210F8 /* RNCWebViewManager.m in Sources */,
116
 			);
122
 			);
117
 			runOnlyForDeploymentPostprocessing = 0;
123
 			runOnlyForDeploymentPostprocessing = 0;
118
 		};
124
 		};
204
 			isa = XCBuildConfiguration;
210
 			isa = XCBuildConfiguration;
205
 			buildSettings = {
211
 			buildSettings = {
206
 				HEADER_SEARCH_PATHS = (
212
 				HEADER_SEARCH_PATHS = (
207
-				"$(inherited)",
213
+					"$(inherited)",
208
 					/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
214
 					/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
209
 					"$(SRCROOT)/../../../React/**",
215
 					"$(SRCROOT)/../../../React/**",
210
 					"$(SRCROOT)/../../react-native/React/**",
216
 					"$(SRCROOT)/../../react-native/React/**",
211
 				);
217
 				);
212
 				LIBRARY_SEARCH_PATHS = "$(inherited)";
218
 				LIBRARY_SEARCH_PATHS = "$(inherited)";
213
 				OTHER_LDFLAGS = "-ObjC";
219
 				OTHER_LDFLAGS = "-ObjC";
214
-				PRODUCT_NAME = RCTWebView;
220
+				PRODUCT_NAME = RNCWebView;
215
 				SKIP_INSTALL = YES;
221
 				SKIP_INSTALL = YES;
216
 			};
222
 			};
217
 			name = Debug;
223
 			name = Debug;
227
 				);
233
 				);
228
 				LIBRARY_SEARCH_PATHS = "$(inherited)";
234
 				LIBRARY_SEARCH_PATHS = "$(inherited)";
229
 				OTHER_LDFLAGS = "-ObjC";
235
 				OTHER_LDFLAGS = "-ObjC";
230
-				PRODUCT_NAME = RCTWebView;
236
+				PRODUCT_NAME = RNCWebView;
231
 				SKIP_INSTALL = YES;
237
 				SKIP_INSTALL = YES;
232
 			};
238
 			};
233
 			name = Release;
239
 			name = Release;
235
 /* End XCBuildConfiguration section */
241
 /* End XCBuildConfiguration section */
236
 
242
 
237
 /* Begin XCConfigurationList section */
243
 /* Begin XCConfigurationList section */
238
-		58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RCTWebView" */ = {
244
+		58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNCWebView" */ = {
239
 			isa = XCConfigurationList;
245
 			isa = XCConfigurationList;
240
 			buildConfigurations = (
246
 			buildConfigurations = (
241
 				58B511ED1A9E6C8500147676 /* Debug */,
247
 				58B511ED1A9E6C8500147676 /* Debug */,
244
 			defaultConfigurationIsVisible = 0;
250
 			defaultConfigurationIsVisible = 0;
245
 			defaultConfigurationName = Release;
251
 			defaultConfigurationName = Release;
246
 		};
252
 		};
247
-		58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RCTWebView" */ = {
253
+		58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNCWebView" */ = {
248
 			isa = XCConfigurationList;
254
 			isa = XCConfigurationList;
249
 			buildConfigurations = (
255
 			buildConfigurations = (
250
 				58B511F01A9E6C8500147676 /* Debug */,
256
 				58B511F01A9E6C8500147676 /* Debug */,

ios/RCTWebView.xcworkspace/contents.xcworkspacedata → ios/RNCWebView.xcworkspace/contents.xcworkspacedata Vedi File

3
 <Workspace
3
 <Workspace
4
    version = "1.0">
4
    version = "1.0">
5
    <FileRef
5
    <FileRef
6
-      location = "group:RCTWebView.xcodeproj">
6
+      location = "group:RNCWebView.xcodeproj">
7
    </FileRef>
7
    </FileRef>
8
 </Workspace>
8
 </Workspace>
9
   
9
   

ios/RCTWebViewManager.h → ios/RNCWebViewManager.h Vedi File

1
 /**
1
 /**
2
- * Copyright (c) 2015-present, Facebook, Inc.
2
+ * Copyright (c) 2018-present, Infinite Red, Inc.
3
  *
3
  *
4
  * This source code is licensed under the MIT license found in the
4
  * This source code is licensed under the MIT license found in the
5
  * LICENSE file in the root directory of this source tree.
5
  * LICENSE file in the root directory of this source tree.
7
 
7
 
8
 #import <React/RCTViewManager.h>
8
 #import <React/RCTViewManager.h>
9
 
9
 
10
-@interface RCTWebViewManager : RCTViewManager
10
+@interface RNCWebViewManager : RCTViewManager
11
 
11
 
12
 @end
12
 @end

ios/RCTWebViewManager.m → ios/RNCWebViewManager.m Vedi File

1
 /**
1
 /**
2
- * Copyright (c) 2015-present, Facebook, Inc.
2
+ * Copyright (c) 2018-present, Infinite Red, Inc.
3
  *
3
  *
4
  * This source code is licensed under the MIT license found in the
4
  * This source code is licensed under the MIT license found in the
5
  * LICENSE file in the root directory of this source tree.
5
  * LICENSE file in the root directory of this source tree.
6
  */
6
  */
7
 
7
 
8
-#import "RCTWebViewManager.h"
8
+#import "RNCWebViewManager.h"
9
 
9
 
10
-#import "RCTBridge.h"
11
-#import "RCTUIManager.h"
12
-#import "RCTWebView.h"
13
-#import "UIView+React.h"
10
+#import <React/RCTBridge.h>
11
+#import <React/RCTUIManager.h>
12
+#import <React/UIView+React.h>
13
+#import "RNCWebView.h"
14
 
14
 
15
-@interface RCTWebViewManager () <RCTWebViewDelegate>
15
+@interface RNCWebViewManager () <RNCWebViewDelegate>
16
 
16
 
17
 @end
17
 @end
18
 
18
 
19
-@implementation RCTWebViewManager
19
+@implementation RNCWebViewManager
20
 {
20
 {
21
   NSConditionLock *_shouldStartLoadLock;
21
   NSConditionLock *_shouldStartLoadLock;
22
   BOOL _shouldStartLoad;
22
   BOOL _shouldStartLoad;
26
 
26
 
27
 - (UIView *)view
27
 - (UIView *)view
28
 {
28
 {
29
-  RCTWebView *webView = [RCTWebView new];
29
+  RNCWebView *webView = [RNCWebView new];
30
   webView.delegate = self;
30
   webView.delegate = self;
31
   return webView;
31
   return webView;
32
 }
32
 }
51
 
51
 
52
 RCT_EXPORT_METHOD(goBack:(nonnull NSNumber *)reactTag)
52
 RCT_EXPORT_METHOD(goBack:(nonnull NSNumber *)reactTag)
53
 {
53
 {
54
-  [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RCTWebView *> *viewRegistry) {
55
-    RCTWebView *view = viewRegistry[reactTag];
56
-    if (![view isKindOfClass:[RCTWebView class]]) {
57
-      RCTLogError(@"Invalid view returned from registry, expecting RCTWebView, got: %@", view);
54
+  [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RNCWebView *> *viewRegistry) {
55
+    RNCWebView *view = viewRegistry[reactTag];
56
+    if (![view isKindOfClass:[RNCWebView class]]) {
57
+      RCTLogError(@"Invalid view returned from registry, expecting RNCWebView, got: %@", view);
58
     } else {
58
     } else {
59
       [view goBack];
59
       [view goBack];
60
     }
60
     }
65
 {
65
 {
66
   [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
66
   [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
67
     id view = viewRegistry[reactTag];
67
     id view = viewRegistry[reactTag];
68
-    if (![view isKindOfClass:[RCTWebView class]]) {
69
-      RCTLogError(@"Invalid view returned from registry, expecting RCTWebView, got: %@", view);
68
+    if (![view isKindOfClass:[RNCWebView class]]) {
69
+      RCTLogError(@"Invalid view returned from registry, expecting RNCWebView, got: %@", view);
70
     } else {
70
     } else {
71
       [view goForward];
71
       [view goForward];
72
     }
72
     }
75
 
75
 
76
 RCT_EXPORT_METHOD(reload:(nonnull NSNumber *)reactTag)
76
 RCT_EXPORT_METHOD(reload:(nonnull NSNumber *)reactTag)
77
 {
77
 {
78
-  [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RCTWebView *> *viewRegistry) {
79
-    RCTWebView *view = viewRegistry[reactTag];
80
-    if (![view isKindOfClass:[RCTWebView class]]) {
81
-      RCTLogError(@"Invalid view returned from registry, expecting RCTWebView, got: %@", view);
78
+  [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RNCWebView *> *viewRegistry) {
79
+    RNCWebView *view = viewRegistry[reactTag];
80
+    if (![view isKindOfClass:[RNCWebView class]]) {
81
+      RCTLogError(@"Invalid view returned from registry, expecting RNCWebView, got: %@", view);
82
     } else {
82
     } else {
83
       [view reload];
83
       [view reload];
84
     }
84
     }
87
 
87
 
88
 RCT_EXPORT_METHOD(stopLoading:(nonnull NSNumber *)reactTag)
88
 RCT_EXPORT_METHOD(stopLoading:(nonnull NSNumber *)reactTag)
89
 {
89
 {
90
-  [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RCTWebView *> *viewRegistry) {
91
-    RCTWebView *view = viewRegistry[reactTag];
92
-    if (![view isKindOfClass:[RCTWebView class]]) {
93
-      RCTLogError(@"Invalid view returned from registry, expecting RCTWebView, got: %@", view);
90
+  [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RNCWebView *> *viewRegistry) {
91
+    RNCWebView *view = viewRegistry[reactTag];
92
+    if (![view isKindOfClass:[RNCWebView class]]) {
93
+      RCTLogError(@"Invalid view returned from registry, expecting RNCWebView, got: %@", view);
94
     } else {
94
     } else {
95
       [view stopLoading];
95
       [view stopLoading];
96
     }
96
     }
99
 
99
 
100
 RCT_EXPORT_METHOD(postMessage:(nonnull NSNumber *)reactTag message:(NSString *)message)
100
 RCT_EXPORT_METHOD(postMessage:(nonnull NSNumber *)reactTag message:(NSString *)message)
101
 {
101
 {
102
-  [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RCTWebView *> *viewRegistry) {
103
-    RCTWebView *view = viewRegistry[reactTag];
104
-    if (![view isKindOfClass:[RCTWebView class]]) {
105
-      RCTLogError(@"Invalid view returned from registry, expecting RCTWebView, got: %@", view);
102
+  [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RNCWebView *> *viewRegistry) {
103
+    RNCWebView *view = viewRegistry[reactTag];
104
+    if (![view isKindOfClass:[RNCWebView class]]) {
105
+      RCTLogError(@"Invalid view returned from registry, expecting RNCWebView, got: %@", view);
106
     } else {
106
     } else {
107
       [view postMessage:message];
107
       [view postMessage:message];
108
     }
108
     }
111
 
111
 
112
 RCT_EXPORT_METHOD(injectJavaScript:(nonnull NSNumber *)reactTag script:(NSString *)script)
112
 RCT_EXPORT_METHOD(injectJavaScript:(nonnull NSNumber *)reactTag script:(NSString *)script)
113
 {
113
 {
114
-  [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RCTWebView *> *viewRegistry) {
115
-    RCTWebView *view = viewRegistry[reactTag];
116
-    if (![view isKindOfClass:[RCTWebView class]]) {
117
-      RCTLogError(@"Invalid view returned from registry, expecting RCTWebView, got: %@", view);
114
+  [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RNCWebView *> *viewRegistry) {
115
+    RNCWebView *view = viewRegistry[reactTag];
116
+    if (![view isKindOfClass:[RNCWebView class]]) {
117
+      RCTLogError(@"Invalid view returned from registry, expecting RNCWebView, got: %@", view);
118
     } else {
118
     } else {
119
       [view injectJavaScript:script];
119
       [view injectJavaScript:script];
120
     }
120
     }
123
 
123
 
124
 #pragma mark - Exported synchronous methods
124
 #pragma mark - Exported synchronous methods
125
 
125
 
126
-- (BOOL)webView:(__unused RCTWebView *)webView
126
+- (BOOL)webView:(__unused RNCWebView *)webView
127
 shouldStartLoadForRequest:(NSMutableDictionary<NSString *, id> *)request
127
 shouldStartLoadForRequest:(NSMutableDictionary<NSString *, id> *)request
128
    withCallback:(RCTDirectEventBlock)callback
128
    withCallback:(RCTDirectEventBlock)callback
129
 {
129
 {

+ 9
- 9
js/WebView.android.js Vedi File

272
         );
272
         );
273
     } else if (this.state.viewState !== WebViewState.IDLE) {
273
     } else if (this.state.viewState !== WebViewState.IDLE) {
274
       console.error(
274
       console.error(
275
-        'RCTWebView invalid state encountered: ' + this.state.loading,
275
+        'RNCWebView invalid state encountered: ' + this.state.loading,
276
       );
276
       );
277
     }
277
     }
278
 
278
 
306
       WebViewShared.originWhitelistToRegex,
306
       WebViewShared.originWhitelistToRegex,
307
     );
307
     );
308
 
308
 
309
-    let NativeWebView = nativeConfig.component || RCTWebView;
309
+    let NativeWebView = nativeConfig.component || RNCWebView;
310
 
310
 
311
     const webView = (
311
     const webView = (
312
       <NativeWebView
312
       <NativeWebView
357
   goForward = () => {
357
   goForward = () => {
358
     UIManager.dispatchViewManagerCommand(
358
     UIManager.dispatchViewManagerCommand(
359
       this.getWebViewHandle(),
359
       this.getWebViewHandle(),
360
-      UIManager.RCTWebView.Commands.goForward,
360
+      UIManager.RNCWebView.Commands.goForward,
361
       null,
361
       null,
362
     );
362
     );
363
   };
363
   };
365
   goBack = () => {
365
   goBack = () => {
366
     UIManager.dispatchViewManagerCommand(
366
     UIManager.dispatchViewManagerCommand(
367
       this.getWebViewHandle(),
367
       this.getWebViewHandle(),
368
-      UIManager.RCTWebView.Commands.goBack,
368
+      UIManager.RNCWebView.Commands.goBack,
369
       null,
369
       null,
370
     );
370
     );
371
   };
371
   };
376
     });
376
     });
377
     UIManager.dispatchViewManagerCommand(
377
     UIManager.dispatchViewManagerCommand(
378
       this.getWebViewHandle(),
378
       this.getWebViewHandle(),
379
-      UIManager.RCTWebView.Commands.reload,
379
+      UIManager.RNCWebView.Commands.reload,
380
       null,
380
       null,
381
     );
381
     );
382
   };
382
   };
384
   stopLoading = () => {
384
   stopLoading = () => {
385
     UIManager.dispatchViewManagerCommand(
385
     UIManager.dispatchViewManagerCommand(
386
       this.getWebViewHandle(),
386
       this.getWebViewHandle(),
387
-      UIManager.RCTWebView.Commands.stopLoading,
387
+      UIManager.RNCWebView.Commands.stopLoading,
388
       null,
388
       null,
389
     );
389
     );
390
   };
390
   };
392
   postMessage = data => {
392
   postMessage = data => {
393
     UIManager.dispatchViewManagerCommand(
393
     UIManager.dispatchViewManagerCommand(
394
       this.getWebViewHandle(),
394
       this.getWebViewHandle(),
395
-      UIManager.RCTWebView.Commands.postMessage,
395
+      UIManager.RNCWebView.Commands.postMessage,
396
       [String(data)],
396
       [String(data)],
397
     );
397
     );
398
   };
398
   };
406
   injectJavaScript = data => {
406
   injectJavaScript = data => {
407
     UIManager.dispatchViewManagerCommand(
407
     UIManager.dispatchViewManagerCommand(
408
       this.getWebViewHandle(),
408
       this.getWebViewHandle(),
409
-      UIManager.RCTWebView.Commands.injectJavaScript,
409
+      UIManager.RNCWebView.Commands.injectJavaScript,
410
       [data],
410
       [data],
411
     );
411
     );
412
   };
412
   };
460
   };
460
   };
461
 }
461
 }
462
 
462
 
463
-const RCTWebView = requireNativeComponent('RCTWebView');
463
+const RNCWebView = requireNativeComponent('RNCWebView');
464
 
464
 
465
 const styles = StyleSheet.create({
465
 const styles = StyleSheet.create({
466
   container: {
466
   container: {

+ 1
- 1
js/WebView.integration.js Vedi File

1
 /**
1
 /**
2
- * Copyright (c) 2015-present, Facebook, Inc.
2
+ * Copyright (c) 2018-present, Infinite Red, Inc.
3
  *
3
  *
4
  * This source code is licensed under the MIT license found in the
4
  * This source code is licensed under the MIT license found in the
5
  * LICENSE file in the root directory of this source tree.
5
  * LICENSE file in the root directory of this source tree.

+ 11
- 11
js/WebView.ios.js Vedi File

49
 }
49
 }
50
 
50
 
51
 
51
 
52
-const RCTWebViewManager = 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';
436
       );
436
       );
437
     } else if (this.state.viewState !== WebViewState.IDLE) {
437
     } else if (this.state.viewState !== WebViewState.IDLE) {
438
       console.error(
438
       console.error(
439
-        'RCTWebView invalid state encountered: ' + this.state.loading,
439
+        'RNCWebView invalid state encountered: ' + this.state.loading,
440
       );
440
       );
441
     }
441
     }
442
 
442
 
451
 
451
 
452
     const nativeConfig = this.props.nativeConfig || {};
452
     const nativeConfig = this.props.nativeConfig || {};
453
 
453
 
454
-    const viewManager = nativeConfig.viewManager || RCTWebViewManager;
454
+    const viewManager = nativeConfig.viewManager || RNCWebViewManager;
455
 
455
 
456
     const compiledWhitelist = (this.props.originWhitelist || []).map(
456
     const compiledWhitelist = (this.props.originWhitelist || []).map(
457
       WebViewShared.originWhitelistToRegex,
457
       WebViewShared.originWhitelistToRegex,
491
 
491
 
492
     const messagingEnabled = typeof this.props.onMessage === 'function';
492
     const messagingEnabled = typeof this.props.onMessage === 'function';
493
 
493
 
494
-    const NativeWebView = nativeConfig.component || RCTWebView;
494
+    const NativeWebView = nativeConfig.component || RNCWebView;
495
 
495
 
496
     const webView = (
496
     const webView = (
497
       <NativeWebView
497
       <NativeWebView
537
   goForward = () => {
537
   goForward = () => {
538
     UIManager.dispatchViewManagerCommand(
538
     UIManager.dispatchViewManagerCommand(
539
       this.getWebViewHandle(),
539
       this.getWebViewHandle(),
540
-      UIManager.RCTWebView.Commands.goForward,
540
+      UIManager.RNCWebView.Commands.goForward,
541
       null,
541
       null,
542
     );
542
     );
543
   };
543
   };
548
   goBack = () => {
548
   goBack = () => {
549
     UIManager.dispatchViewManagerCommand(
549
     UIManager.dispatchViewManagerCommand(
550
       this.getWebViewHandle(),
550
       this.getWebViewHandle(),
551
-      UIManager.RCTWebView.Commands.goBack,
551
+      UIManager.RNCWebView.Commands.goBack,
552
       null,
552
       null,
553
     );
553
     );
554
   };
554
   };
560
     this.setState({ viewState: WebViewState.LOADING });
560
     this.setState({ viewState: WebViewState.LOADING });
561
     UIManager.dispatchViewManagerCommand(
561
     UIManager.dispatchViewManagerCommand(
562
       this.getWebViewHandle(),
562
       this.getWebViewHandle(),
563
-      UIManager.RCTWebView.Commands.reload,
563
+      UIManager.RNCWebView.Commands.reload,
564
       null,
564
       null,
565
     );
565
     );
566
   };
566
   };
571
   stopLoading = () => {
571
   stopLoading = () => {
572
     UIManager.dispatchViewManagerCommand(
572
     UIManager.dispatchViewManagerCommand(
573
       this.getWebViewHandle(),
573
       this.getWebViewHandle(),
574
-      UIManager.RCTWebView.Commands.stopLoading,
574
+      UIManager.RNCWebView.Commands.stopLoading,
575
       null,
575
       null,
576
     );
576
     );
577
   };
577
   };
589
   postMessage = data => {
589
   postMessage = data => {
590
     UIManager.dispatchViewManagerCommand(
590
     UIManager.dispatchViewManagerCommand(
591
       this.getWebViewHandle(),
591
       this.getWebViewHandle(),
592
-      UIManager.RCTWebView.Commands.postMessage,
592
+      UIManager.RNCWebView.Commands.postMessage,
593
       [String(data)],
593
       [String(data)],
594
     );
594
     );
595
   };
595
   };
603
   injectJavaScript = data => {
603
   injectJavaScript = data => {
604
     UIManager.dispatchViewManagerCommand(
604
     UIManager.dispatchViewManagerCommand(
605
       this.getWebViewHandle(),
605
       this.getWebViewHandle(),
606
-      UIManager.RCTWebView.Commands.injectJavaScript,
606
+      UIManager.RNCWebView.Commands.injectJavaScript,
607
       [data],
607
       [data],
608
     );
608
     );
609
   };
609
   };
660
   };
660
   };
661
 }
661
 }
662
 
662
 
663
-const RCTWebView = requireNativeComponent('RCTWebView');
663
+const RNCWebView = requireNativeComponent('RNCWebView');
664
 
664
 
665
 const styles = StyleSheet.create({
665
 const styles = StyleSheet.create({
666
   container: {
666
   container: {

+ 2
- 2
package.json Vedi File

1
 {
1
 {
2
-  "name": "react-native-webview",
2
+  "name": "ir-webview",
3
   "description": "React Native WebView component for iOS + Android",
3
   "description": "React Native WebView component for iOS + Android",
4
   "main": "index.js",
4
   "main": "index.js",
5
   "authors": [
5
   "authors": [
6
-    "Jamon Holmgren <jamonholmgren@gmail.com>"
6
+    "Jamon Holmgren <jamon@infinite.red>"
7
   ],
7
   ],
8
   "version": "0.0.1",
8
   "version": "0.0.1",
9
   "peerDependencies": {
9
   "peerDependencies": {