Parcourir la source

Native Changes

Thibault Malbranche il y a 6 ans
Parent
révision
0de29728a6

+ 0
- 5
ios/RCTUIWebViewManager.h Voir le fichier

@@ -1,5 +0,0 @@
1
-#import <React/RCTViewManager.h>
2
-
3
-@interface RCTUIWebViewManager : RCTViewManager
4
-
5
-@end

ios/RCTUIWebView.h → ios/RNCUIWebView.h Voir le fichier

@@ -1,6 +1,6 @@
1 1
 #import <React/RCTView.h>
2 2
 
3
-@class RCTUIWebView;
3
+@class RNCUIWebView;
4 4
 
5 5
 /**
6 6
  * Special scheme used to pass messages to the injectedJavaScript
@@ -10,17 +10,17 @@
10 10
  */
11 11
 extern NSString *const RNCJSNavigationScheme;
12 12
 
13
-@protocol RCTUIWebViewDelegate <NSObject>
13
+@protocol RNCUIWebViewDelegate <NSObject>
14 14
 
15
-- (BOOL)webView:(RCTUIWebView *)webView
15
+- (BOOL)webView:(RNCUIWebView *)webView
16 16
 shouldStartLoadForRequest:(NSMutableDictionary<NSString *, id> *)request
17 17
    withCallback:(RCTDirectEventBlock)callback;
18 18
 
19 19
 @end
20 20
 
21
-@interface RCTUIWebView : RCTView
21
+@interface RNCUIWebView : RCTView
22 22
 
23
-@property (nonatomic, weak) id<RCTUIWebViewDelegate> delegate;
23
+@property (nonatomic, weak) id<RNCUIWebViewDelegate> delegate;
24 24
 
25 25
 @property (nonatomic, copy) NSDictionary *source;
26 26
 @property (nonatomic, assign) UIEdgeInsets contentInset;

ios/RCTUIWebView.m → ios/RNCUIWebView.m Voir le fichier

@@ -1,4 +1,4 @@
1
-#import "RCTUIWebView.h"
1
+#import "RNCUIWebView.h"
2 2
 
3 3
 // #import <UIKit/UIKit.h>
4 4
 #import <React/RCTAutoInsetsProtocol.h>
@@ -13,7 +13,7 @@ NSString *const RNCJSNavigationScheme = @"react-js-navigation";
13 13
 
14 14
 static NSString *const kPostMessageHost = @"postMessage";
15 15
 
16
-@interface RCTUIWebView () <UIWebViewDelegate, RCTAutoInsetsProtocol>
16
+@interface RNCUIWebView () <UIWebViewDelegate, RCTAutoInsetsProtocol>
17 17
 
18 18
 @property (nonatomic, copy) RCTDirectEventBlock onLoadingStart;
19 19
 @property (nonatomic, copy) RCTDirectEventBlock onLoadingFinish;
@@ -23,7 +23,7 @@ static NSString *const kPostMessageHost = @"postMessage";
23 23
 
24 24
 @end
25 25
 
26
-@implementation RCTUIWebView
26
+@implementation RNCUIWebView
27 27
 {
28 28
   UIWebView *_webView;
29 29
   NSString *_injectedJavaScript;

+ 5
- 0
ios/RNCUIWebViewManager.h Voir le fichier

@@ -0,0 +1,5 @@
1
+#import <React/RCTViewManager.h>
2
+
3
+@interface RNCUIWebViewManager : RCTViewManager
4
+
5
+@end

ios/RCTUIWebViewManager.m → ios/RNCUIWebViewManager.m Voir le fichier

@@ -1,15 +1,15 @@
1
-#import "RCTUIWebViewManager.h"
1
+#import "RNCUIWebViewManager.h"
2 2
 
3 3
 #import <React/RCTBridge.h>
4 4
 #import <React/RCTUIManager.h>
5 5
 #import <React/UIView+React.h>
6
-#import "RCTUIWebView.h"
6
+#import "RNCUIWebView.h"
7 7
 
8
-@interface RCTUIWebViewManager () <RCTUIWebViewDelegate>
8
+@interface RNCUIWebViewManager () <RNCUIWebViewDelegate>
9 9
 
10 10
 @end
11 11
 
12
-@implementation RCTUIWebViewManager
12
+@implementation RNCUIWebViewManager
13 13
 {
14 14
   NSConditionLock *_shouldStartLoadLock;
15 15
   BOOL _shouldStartLoad;
@@ -19,7 +19,7 @@ RCT_EXPORT_MODULE()
19 19
 
20 20
 - (UIView *)view
21 21
 {
22
-  RCTUIWebView *webView = [RCTUIWebView new];
22
+  RNCUIWebView *webView = [RNCUIWebView new];
23 23
   webView.delegate = self;
24 24
   return webView;
25 25
 }
@@ -44,10 +44,10 @@ RCT_REMAP_VIEW_PROPERTY(dataDetectorTypes, _webView.dataDetectorTypes, UIDataDet
44 44
 
45 45
 RCT_EXPORT_METHOD(goBack:(nonnull NSNumber *)reactTag)
46 46
 {
47
-  [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RCTUIWebView *> *viewRegistry) {
48
-    RCTUIWebView *view = viewRegistry[reactTag];
49
-    if (![view isKindOfClass:[RCTUIWebView class]]) {
50
-      RCTLogError(@"Invalid view returned from registry, expecting RCTUIWebView, got: %@", view);
47
+  [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RNCUIWebView *> *viewRegistry) {
48
+    RNCUIWebView *view = viewRegistry[reactTag];
49
+    if (![view isKindOfClass:[RNCUIWebView class]]) {
50
+      RCTLogError(@"Invalid view returned from registry, expecting RNCUIWebView, got: %@", view);
51 51
     } else {
52 52
       [view goBack];
53 53
     }
@@ -57,9 +57,9 @@ RCT_EXPORT_METHOD(goBack:(nonnull NSNumber *)reactTag)
57 57
 RCT_EXPORT_METHOD(goForward:(nonnull NSNumber *)reactTag)
58 58
 {
59 59
   [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
60
-    RCTUIWebView *view = viewRegistry[reactTag];
61
-    if (![view isKindOfClass:[RCTUIWebView class]]) {
62
-      RCTLogError(@"Invalid view returned from registry, expecting RCTUIWebView, got: %@", view);
60
+    RNCUIWebView *view = viewRegistry[reactTag];
61
+    if (![view isKindOfClass:[RNCUIWebView class]]) {
62
+      RCTLogError(@"Invalid view returned from registry, expecting RNCUIWebView, got: %@", view);
63 63
     } else {
64 64
       [view goForward];
65 65
     }
@@ -68,10 +68,10 @@ RCT_EXPORT_METHOD(goForward:(nonnull NSNumber *)reactTag)
68 68
 
69 69
 RCT_EXPORT_METHOD(reload:(nonnull NSNumber *)reactTag)
70 70
 {
71
-  [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RCTUIWebView *> *viewRegistry) {
72
-    RCTUIWebView *view = viewRegistry[reactTag];
73
-    if (![view isKindOfClass:[RCTUIWebView class]]) {
74
-      RCTLogError(@"Invalid view returned from registry, expecting RCTUIWebView, got: %@", view);
71
+  [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RNCUIWebView *> *viewRegistry) {
72
+    RNCUIWebView *view = viewRegistry[reactTag];
73
+    if (![view isKindOfClass:[RNCUIWebView class]]) {
74
+      RCTLogError(@"Invalid view returned from registry, expecting RNCUIWebView, got: %@", view);
75 75
     } else {
76 76
       [view reload];
77 77
     }
@@ -80,10 +80,10 @@ RCT_EXPORT_METHOD(reload:(nonnull NSNumber *)reactTag)
80 80
 
81 81
 RCT_EXPORT_METHOD(stopLoading:(nonnull NSNumber *)reactTag)
82 82
 {
83
-  [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RCTUIWebView *> *viewRegistry) {
84
-    RCTUIWebView *view = viewRegistry[reactTag];
85
-    if (![view isKindOfClass:[RCTUIWebView class]]) {
86
-      RCTLogError(@"Invalid view returned from registry, expecting RCTUIWebView, got: %@", view);
83
+  [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RNCUIWebView *> *viewRegistry) {
84
+    RNCUIWebView *view = viewRegistry[reactTag];
85
+    if (![view isKindOfClass:[RNCUIWebView class]]) {
86
+      RCTLogError(@"Invalid view returned from registry, expecting RNCUIWebView, got: %@", view);
87 87
     } else {
88 88
       [view stopLoading];
89 89
     }
@@ -92,10 +92,10 @@ RCT_EXPORT_METHOD(stopLoading:(nonnull NSNumber *)reactTag)
92 92
 
93 93
 RCT_EXPORT_METHOD(postMessage:(nonnull NSNumber *)reactTag message:(NSString *)message)
94 94
 {
95
-  [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RCTUIWebView *> *viewRegistry) {
96
-    RCTUIWebView *view = viewRegistry[reactTag];
97
-    if (![view isKindOfClass:[RCTUIWebView class]]) {
98
-      RCTLogError(@"Invalid view returned from registry, expecting RCTUIWebView, got: %@", view);
95
+  [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RNCUIWebView *> *viewRegistry) {
96
+    RNCUIWebView *view = viewRegistry[reactTag];
97
+    if (![view isKindOfClass:[RNCUIWebView class]]) {
98
+      RCTLogError(@"Invalid view returned from registry, expecting RNCUIWebView, got: %@", view);
99 99
     } else {
100 100
       [view postMessage:message];
101 101
     }
@@ -104,10 +104,10 @@ RCT_EXPORT_METHOD(postMessage:(nonnull NSNumber *)reactTag message:(NSString *)m
104 104
 
105 105
 RCT_EXPORT_METHOD(injectJavaScript:(nonnull NSNumber *)reactTag script:(NSString *)script)
106 106
 {
107
-  [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RCTUIWebView *> *viewRegistry) {
108
-    RCTUIWebView *view = viewRegistry[reactTag];
109
-    if (![view isKindOfClass:[RCTUIWebView class]]) {
110
-      RCTLogError(@"Invalid view returned from registry, expecting RCTUIWebView, got: %@", view);
107
+  [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RNCUIWebView *> *viewRegistry) {
108
+    RNCUIWebView *view = viewRegistry[reactTag];
109
+    if (![view isKindOfClass:[RNCUIWebView class]]) {
110
+      RCTLogError(@"Invalid view returned from registry, expecting RNCUIWebView, got: %@", view);
111 111
     } else {
112 112
       [view injectJavaScript:script];
113 113
     }
@@ -116,7 +116,7 @@ RCT_EXPORT_METHOD(injectJavaScript:(nonnull NSNumber *)reactTag script:(NSString
116 116
 
117 117
 #pragma mark - Exported synchronous methods
118 118
 
119
-- (BOOL)webView:(__unused RCTUIWebView *)webView
119
+- (BOOL)webView:(__unused RNCUIWebView *)webView
120 120
 shouldStartLoadForRequest:(NSMutableDictionary<NSString *, id> *)request
121 121
    withCallback:(RCTDirectEventBlock)callback
122 122
 {

ios/RCTWKWebView.h → ios/RNCWKWebView.h Voir le fichier

@@ -9,19 +9,19 @@
9 9
 #import <React/RCTDefines.h>
10 10
 #import <WebKit/WebKit.h>
11 11
 
12
-@class RCTWKWebView;
12
+@class RNCWKWebView;
13 13
 
14
-@protocol RCTWKWebViewDelegate <NSObject>
14
+@protocol RNCWKWebViewDelegate <NSObject>
15 15
 
16
-- (BOOL)webView:(RCTWKWebView *)webView
16
+- (BOOL)webView:(RNCWKWebView *)webView
17 17
 shouldStartLoadForRequest:(NSMutableDictionary<NSString *, id> *)request
18 18
    withCallback:(RCTDirectEventBlock)callback;
19 19
 
20 20
 @end
21 21
 
22
-@interface RCTWKWebView : RCTView
22
+@interface RNCWKWebView : RCTView
23 23
 
24
-@property (nonatomic, weak) id<RCTWKWebViewDelegate> delegate;
24
+@property (nonatomic, weak) id<RNCWKWebViewDelegate> delegate;
25 25
 @property (nonatomic, copy) NSDictionary *source;
26 26
 @property (nonatomic, assign) BOOL messagingEnabled;
27 27
 @property (nonatomic, copy) NSString *injectedJavaScript;

ios/RCTWKWebView.m → ios/RNCWKWebView.m Voir le fichier

@@ -5,13 +5,13 @@
5 5
  * LICENSE file in the root directory of this source tree.
6 6
  */
7 7
 
8
-#import "RCTWKWebView.h"
8
+#import "RNCWKWebView.h"
9 9
 #import <React/RCTConvert.h>
10 10
 #import <React/RCTAutoInsetsProtocol.h>
11 11
 
12 12
 static NSString *const MessageHanderName = @"ReactNative";
13 13
 
14
-@interface RCTWKWebView () <WKUIDelegate, WKNavigationDelegate, WKScriptMessageHandler, UIScrollViewDelegate, RCTAutoInsetsProtocol>
14
+@interface RNCWKWebView () <WKUIDelegate, WKNavigationDelegate, WKScriptMessageHandler, UIScrollViewDelegate, RCTAutoInsetsProtocol>
15 15
 @property (nonatomic, copy) RCTDirectEventBlock onLoadingStart;
16 16
 @property (nonatomic, copy) RCTDirectEventBlock onLoadingFinish;
17 17
 @property (nonatomic, copy) RCTDirectEventBlock onLoadingError;
@@ -20,7 +20,7 @@ static NSString *const MessageHanderName = @"ReactNative";
20 20
 @property (nonatomic, copy) WKWebView *webView;
21 21
 @end
22 22
 
23
-@implementation RCTWKWebView
23
+@implementation RNCWKWebView
24 24
 {
25 25
   UIColor * _savedBackgroundColor;
26 26
 }
@@ -206,7 +206,7 @@ static NSString *const MessageHanderName = @"ReactNative";
206 206
 {
207 207
   [super layoutSubviews];
208 208
 
209
-  // Ensure webview takes the position and dimensions of RCTWKWebView
209
+  // Ensure webview takes the position and dimensions of RNCWKWebView
210 210
   _webView.frame = self.bounds;
211 211
 }
212 212
 

ios/RCTWKWebViewManager.h → ios/RNCWKWebViewManager.h Voir le fichier

@@ -7,5 +7,5 @@
7 7
 
8 8
 #import <React/RCTViewManager.h>
9 9
 
10
-@interface RCTWKWebViewManager : RCTViewManager
10
+@interface RNCWKWebViewManager : RCTViewManager
11 11
 @end

ios/RCTWKWebViewManager.m → ios/RNCWKWebViewManager.m Voir le fichier

@@ -5,16 +5,16 @@
5 5
  * LICENSE file in the root directory of this source tree.
6 6
  */
7 7
 
8
-#import "RCTWKWebViewManager.h"
8
+#import "RNCWKWebViewManager.h"
9 9
 
10 10
 #import <React/RCTUIManager.h>
11 11
 #import <React/RCTDefines.h>
12
-#import "RCTWKWebView.h"
12
+#import "RNCWKWebView.h"
13 13
 
14
-@interface RCTWKWebViewManager () <RCTWKWebViewDelegate>
14
+@interface RNCWKWebViewManager () <RNCWKWebViewDelegate>
15 15
 @end
16 16
 
17
-@implementation RCTWKWebViewManager
17
+@implementation RNCWKWebViewManager
18 18
 {
19 19
   NSConditionLock *_shouldStartLoadLock;
20 20
   BOOL _shouldStartLoad;
@@ -24,7 +24,7 @@ RCT_EXPORT_MODULE()
24 24
 
25 25
 - (UIView *)view
26 26
 {
27
-  RCTWKWebView *webView = [RCTWKWebView new];
27
+  RNCWKWebView *webView = [RNCWKWebView new];
28 28
   webView.delegate = self;
29 29
   return webView;
30 30
 }
@@ -51,34 +51,34 @@ RCT_EXPORT_VIEW_PROPERTY(onMessage, RCTDirectEventBlock)
51 51
 
52 52
 RCT_EXPORT_METHOD(postMessage:(nonnull NSNumber *)reactTag message:(NSString *)message)
53 53
 {
54
-  [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RCTWKWebView *> *viewRegistry) {
55
-    RCTWKWebView *view = viewRegistry[reactTag];
56
-    if (![view isKindOfClass:[RCTWKWebView class]]) {
57
-      RCTLogError(@"Invalid view returned from registry, expecting RCTWebView, got: %@", view);
54
+  [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RNCWKWebView *> *viewRegistry) {
55
+    RNCWKWebView *view = viewRegistry[reactTag];
56
+    if (![view isKindOfClass:[RNCWKWebView class]]) {
57
+      RCTLogError(@"Invalid view returned from registry, expecting RNCWKWebView, got: %@", view);
58 58
     } else {
59 59
       [view postMessage:message];
60 60
     }
61 61
   }];
62 62
 }
63 63
 
64
-RCT_CUSTOM_VIEW_PROPERTY(bounces, BOOL, RCTWKWebView) {
64
+RCT_CUSTOM_VIEW_PROPERTY(bounces, BOOL, RNCWKWebView) {
65 65
   view.bounces = json == nil ? true : [RCTConvert BOOL: json];
66 66
 }
67 67
 
68
-RCT_CUSTOM_VIEW_PROPERTY(scrollEnabled, BOOL, RCTWKWebView) {
68
+RCT_CUSTOM_VIEW_PROPERTY(scrollEnabled, BOOL, RNCWKWebView) {
69 69
   view.scrollEnabled = json == nil ? true : [RCTConvert BOOL: json];
70 70
 }
71 71
 
72
-RCT_CUSTOM_VIEW_PROPERTY(decelerationRate, CGFloat, RCTWKWebView) {
72
+RCT_CUSTOM_VIEW_PROPERTY(decelerationRate, CGFloat, RNCWKWebView) {
73 73
   view.decelerationRate = json == nil ? UIScrollViewDecelerationRateNormal : [RCTConvert CGFloat: json];
74 74
 }
75 75
 
76 76
 RCT_EXPORT_METHOD(injectJavaScript:(nonnull NSNumber *)reactTag script:(NSString *)script)
77 77
 {
78
-  [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RCTWKWebView *> *viewRegistry) {
79
-    RCTWKWebView *view = viewRegistry[reactTag];
80
-    if (![view isKindOfClass:[RCTWKWebView class]]) {
81
-      RCTLogError(@"Invalid view returned from registry, expecting RCTWebView, got: %@", view);
78
+  [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RNCWKWebView *> *viewRegistry) {
79
+    RNCWKWebView *view = viewRegistry[reactTag];
80
+    if (![view isKindOfClass:[RNCWKWebView class]]) {
81
+      RCTLogError(@"Invalid view returned from registry, expecting RNCWKWebView, got: %@", view);
82 82
     } else {
83 83
       [view injectJavaScript:script];
84 84
     }
@@ -87,10 +87,10 @@ RCT_EXPORT_METHOD(injectJavaScript:(nonnull NSNumber *)reactTag script:(NSString
87 87
 
88 88
 RCT_EXPORT_METHOD(goBack:(nonnull NSNumber *)reactTag)
89 89
 {
90
-  [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RCTWKWebView *> *viewRegistry) {
91
-    RCTWKWebView *view = viewRegistry[reactTag];
92
-    if (![view isKindOfClass:[RCTWKWebView class]]) {
93
-      RCTLogError(@"Invalid view returned from registry, expecting RCTWebView, got: %@", view);
90
+  [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RNCWKWebView *> *viewRegistry) {
91
+    RNCWKWebView *view = viewRegistry[reactTag];
92
+    if (![view isKindOfClass:[RNCWKWebView class]]) {
93
+      RCTLogError(@"Invalid view returned from registry, expecting RNCWKWebView, got: %@", view);
94 94
     } else {
95 95
       [view goBack];
96 96
     }
@@ -99,10 +99,10 @@ RCT_EXPORT_METHOD(goBack:(nonnull NSNumber *)reactTag)
99 99
 
100 100
 RCT_EXPORT_METHOD(goForward:(nonnull NSNumber *)reactTag)
101 101
 {
102
-  [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RCTWKWebView *> *viewRegistry) {
103
-    RCTWKWebView *view = viewRegistry[reactTag];
104
-    if (![view isKindOfClass:[RCTWKWebView class]]) {
105
-      RCTLogError(@"Invalid view returned from registry, expecting RCTWebView, got: %@", view);
102
+  [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RNCWKWebView *> *viewRegistry) {
103
+    RNCWKWebView *view = viewRegistry[reactTag];
104
+    if (![view isKindOfClass:[RNCWKWebView class]]) {
105
+      RCTLogError(@"Invalid view returned from registry, expecting RNCWKWebView, got: %@", view);
106 106
     } else {
107 107
       [view goForward];
108 108
     }
@@ -111,10 +111,10 @@ RCT_EXPORT_METHOD(goForward:(nonnull NSNumber *)reactTag)
111 111
 
112 112
 RCT_EXPORT_METHOD(reload:(nonnull NSNumber *)reactTag)
113 113
 {
114
-  [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RCTWKWebView *> *viewRegistry) {
115
-    RCTWKWebView *view = viewRegistry[reactTag];
116
-    if (![view isKindOfClass:[RCTWKWebView class]]) {
117
-      RCTLogError(@"Invalid view returned from registry, expecting RCTWebView, got: %@", view);
114
+  [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RNCWKWebView *> *viewRegistry) {
115
+    RNCWKWebView *view = viewRegistry[reactTag];
116
+    if (![view isKindOfClass:[RNCWKWebView class]]) {
117
+      RCTLogError(@"Invalid view returned from registry, expecting RNCWKWebView, got: %@", view);
118 118
     } else {
119 119
       [view reload];
120 120
     }
@@ -123,10 +123,10 @@ RCT_EXPORT_METHOD(reload:(nonnull NSNumber *)reactTag)
123 123
 
124 124
 RCT_EXPORT_METHOD(stopLoading:(nonnull NSNumber *)reactTag)
125 125
 {
126
-  [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RCTWKWebView *> *viewRegistry) {
127
-    RCTWKWebView *view = viewRegistry[reactTag];
128
-    if (![view isKindOfClass:[RCTWKWebView class]]) {
129
-      RCTLogError(@"Invalid view returned from registry, expecting RCTWebView, got: %@", view);
126
+  [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RNCWKWebView *> *viewRegistry) {
127
+    RNCWKWebView *view = viewRegistry[reactTag];
128
+    if (![view isKindOfClass:[RNCWKWebView class]]) {
129
+      RCTLogError(@"Invalid view returned from registry, expecting RNCWKWebView, got: %@", view);
130 130
     } else {
131 131
       [view stopLoading];
132 132
     }
@@ -135,7 +135,7 @@ RCT_EXPORT_METHOD(stopLoading:(nonnull NSNumber *)reactTag)
135 135
 
136 136
 #pragma mark - Exported synchronous methods
137 137
 
138
-- (BOOL)          webView:(RCTWKWebView *)webView
138
+- (BOOL)          webView:(RNCWKWebView *)webView
139 139
 shouldStartLoadForRequest:(NSMutableDictionary<NSString *, id> *)request
140 140
              withCallback:(RCTDirectEventBlock)callback
141 141
 {

ios/RCTWebView.xcodeproj/project.pbxproj → ios/RNCWebView.xcodeproj/project.pbxproj Voir le fichier

@@ -7,10 +7,10 @@
7 7
 	objects = {
8 8
 
9 9
 /* Begin PBXBuildFile section */
10
-		E914DBF6214474710071092B /* RCTUIWebViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = E914DBF3214474710071092B /* RCTUIWebViewManager.m */; };
11
-		E914DBF7214474710071092B /* RCTUIWebView.m in Sources */ = {isa = PBXBuildFile; fileRef = E914DBF4214474710071092B /* RCTUIWebView.m */; };
12
-		E91B351D21446E6C00F9801F /* RCTWKWebViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = E91B351B21446E6C00F9801F /* RCTWKWebViewManager.m */; };
13
-		E91B351E21446E6C00F9801F /* RCTWKWebView.m in Sources */ = {isa = PBXBuildFile; fileRef = E91B351C21446E6C00F9801F /* RCTWKWebView.m */; };
10
+		E914DBF6214474710071092B /* RNCUIWebViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = E914DBF3214474710071092B /* RNCUIWebViewManager.m */; };
11
+		E914DBF7214474710071092B /* RNCUIWebView.m in Sources */ = {isa = PBXBuildFile; fileRef = E914DBF4214474710071092B /* RNCUIWebView.m */; };
12
+		E91B351D21446E6C00F9801F /* RNCWKWebViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = E91B351B21446E6C00F9801F /* RNCWKWebViewManager.m */; };
13
+		E91B351E21446E6C00F9801F /* RNCWKWebView.m in Sources */ = {isa = PBXBuildFile; fileRef = E91B351C21446E6C00F9801F /* RNCWKWebView.m */; };
14 14
 /* End PBXBuildFile section */
15 15
 
16 16
 /* Begin PBXCopyFilesBuildPhase section */
@@ -26,15 +26,15 @@
26 26
 /* End PBXCopyFilesBuildPhase section */
27 27
 
28 28
 /* Begin PBXFileReference section */
29
-		134814201AA4EA6300B7C361 /* libRCTWebView.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTWebView.a; sourceTree = BUILT_PRODUCTS_DIR; };
30
-		E914DBF2214474710071092B /* RCTUIWebView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTUIWebView.h; sourceTree = "<group>"; };
31
-		E914DBF3214474710071092B /* RCTUIWebViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTUIWebViewManager.m; sourceTree = "<group>"; };
32
-		E914DBF4214474710071092B /* RCTUIWebView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTUIWebView.m; sourceTree = "<group>"; };
33
-		E914DBF5214474710071092B /* RCTUIWebViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTUIWebViewManager.h; sourceTree = "<group>"; };
34
-		E91B351921446E6C00F9801F /* RCTWKWebViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTWKWebViewManager.h; sourceTree = "<group>"; };
35
-		E91B351A21446E6C00F9801F /* RCTWKWebView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTWKWebView.h; sourceTree = "<group>"; };
36
-		E91B351B21446E6C00F9801F /* RCTWKWebViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTWKWebViewManager.m; sourceTree = "<group>"; };
37
-		E91B351C21446E6C00F9801F /* RCTWKWebView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTWKWebView.m; sourceTree = "<group>"; };
29
+		134814201AA4EA6300B7C361 /* libRNCWebView.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNCWebView.a; sourceTree = BUILT_PRODUCTS_DIR; };
30
+		E914DBF2214474710071092B /* RNCUIWebView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNCUIWebView.h; sourceTree = "<group>"; };
31
+		E914DBF3214474710071092B /* RNCUIWebViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNCUIWebViewManager.m; sourceTree = "<group>"; };
32
+		E914DBF4214474710071092B /* RNCUIWebView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNCUIWebView.m; sourceTree = "<group>"; };
33
+		E914DBF5214474710071092B /* RNCUIWebViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNCUIWebViewManager.h; sourceTree = "<group>"; };
34
+		E91B351921446E6C00F9801F /* RNCWKWebViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNCWKWebViewManager.h; sourceTree = "<group>"; };
35
+		E91B351A21446E6C00F9801F /* RNCWKWebView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNCWKWebView.h; sourceTree = "<group>"; };
36
+		E91B351B21446E6C00F9801F /* RNCWKWebViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNCWKWebViewManager.m; sourceTree = "<group>"; };
37
+		E91B351C21446E6C00F9801F /* RNCWKWebView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNCWKWebView.m; sourceTree = "<group>"; };
38 38
 /* End PBXFileReference section */
39 39
 
40 40
 /* Begin PBXFrameworksBuildPhase section */
@@ -51,7 +51,7 @@
51 51
 		134814211AA4EA7D00B7C361 /* Products */ = {
52 52
 			isa = PBXGroup;
53 53
 			children = (
54
-				134814201AA4EA6300B7C361 /* libRCTWebView.a */,
54
+				134814201AA4EA6300B7C361 /* libRNCWebView.a */,
55 55
 			);
56 56
 			name = Products;
57 57
 			sourceTree = "<group>";
@@ -59,14 +59,14 @@
59 59
 		58B511D21A9E6C8500147676 = {
60 60
 			isa = PBXGroup;
61 61
 			children = (
62
-				E914DBF2214474710071092B /* RCTUIWebView.h */,
63
-				E914DBF4214474710071092B /* RCTUIWebView.m */,
64
-				E914DBF5214474710071092B /* RCTUIWebViewManager.h */,
65
-				E914DBF3214474710071092B /* RCTUIWebViewManager.m */,
66
-				E91B351A21446E6C00F9801F /* RCTWKWebView.h */,
67
-				E91B351C21446E6C00F9801F /* RCTWKWebView.m */,
68
-				E91B351921446E6C00F9801F /* RCTWKWebViewManager.h */,
69
-				E91B351B21446E6C00F9801F /* RCTWKWebViewManager.m */,
62
+				E914DBF2214474710071092B /* RNCUIWebView.h */,
63
+				E914DBF4214474710071092B /* RNCUIWebView.m */,
64
+				E914DBF5214474710071092B /* RNCUIWebViewManager.h */,
65
+				E914DBF3214474710071092B /* RNCUIWebViewManager.m */,
66
+				E91B351A21446E6C00F9801F /* RNCWKWebView.h */,
67
+				E91B351C21446E6C00F9801F /* RNCWKWebView.m */,
68
+				E91B351921446E6C00F9801F /* RNCWKWebViewManager.h */,
69
+				E91B351B21446E6C00F9801F /* RNCWKWebViewManager.m */,
70 70
 				134814211AA4EA7D00B7C361 /* Products */,
71 71
 			);
72 72
 			sourceTree = "<group>";
@@ -74,9 +74,9 @@
74 74
 /* End PBXGroup section */
75 75
 
76 76
 /* Begin PBXNativeTarget section */
77
-		58B511DA1A9E6C8500147676 /* RCTWebView */ = {
77
+		58B511DA1A9E6C8500147676 /* RNCWebView */ = {
78 78
 			isa = PBXNativeTarget;
79
-			buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RCTWebView" */;
79
+			buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNCWebView" */;
80 80
 			buildPhases = (
81 81
 				58B511D71A9E6C8500147676 /* Sources */,
82 82
 				58B511D81A9E6C8500147676 /* Frameworks */,
@@ -86,9 +86,9 @@
86 86
 			);
87 87
 			dependencies = (
88 88
 			);
89
-			name = RCTWebView;
89
+			name = RNCWebView;
90 90
 			productName = RCTDataManager;
91
-			productReference = 134814201AA4EA6300B7C361 /* libRCTWebView.a */;
91
+			productReference = 134814201AA4EA6300B7C361 /* libRNCWebView.a */;
92 92
 			productType = "com.apple.product-type.library.static";
93 93
 		};
94 94
 /* End PBXNativeTarget section */
@@ -105,7 +105,7 @@
105 105
 					};
106 106
 				};
107 107
 			};
108
-			buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RCTWebView" */;
108
+			buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNCWebView" */;
109 109
 			compatibilityVersion = "Xcode 3.2";
110 110
 			developmentRegion = English;
111 111
 			hasScannedForEncodings = 0;
@@ -117,7 +117,7 @@
117 117
 			projectDirPath = "";
118 118
 			projectRoot = "";
119 119
 			targets = (
120
-				58B511DA1A9E6C8500147676 /* RCTWebView */,
120
+				58B511DA1A9E6C8500147676 /* RNCWebView */,
121 121
 			);
122 122
 		};
123 123
 /* End PBXProject section */
@@ -127,10 +127,10 @@
127 127
 			isa = PBXSourcesBuildPhase;
128 128
 			buildActionMask = 2147483647;
129 129
 			files = (
130
-				E91B351D21446E6C00F9801F /* RCTWKWebViewManager.m in Sources */,
131
-				E914DBF7214474710071092B /* RCTUIWebView.m in Sources */,
132
-				E914DBF6214474710071092B /* RCTUIWebViewManager.m in Sources */,
133
-				E91B351E21446E6C00F9801F /* RCTWKWebView.m in Sources */,
130
+				E91B351D21446E6C00F9801F /* RNCWKWebViewManager.m in Sources */,
131
+				E914DBF7214474710071092B /* RNCUIWebView.m in Sources */,
132
+				E914DBF6214474710071092B /* RNCUIWebViewManager.m in Sources */,
133
+				E91B351E21446E6C00F9801F /* RNCWKWebView.m in Sources */,
134 134
 			);
135 135
 			runOnlyForDeploymentPostprocessing = 0;
136 136
 		};
@@ -229,7 +229,7 @@
229 229
 				);
230 230
 				LIBRARY_SEARCH_PATHS = "$(inherited)";
231 231
 				OTHER_LDFLAGS = "-ObjC";
232
-				PRODUCT_NAME = RCTWebView;
232
+				PRODUCT_NAME = RNCWebView;
233 233
 				SKIP_INSTALL = YES;
234 234
 			};
235 235
 			name = Debug;
@@ -245,7 +245,7 @@
245 245
 				);
246 246
 				LIBRARY_SEARCH_PATHS = "$(inherited)";
247 247
 				OTHER_LDFLAGS = "-ObjC";
248
-				PRODUCT_NAME = RCTWebView;
248
+				PRODUCT_NAME = RNCWebView;
249 249
 				SKIP_INSTALL = YES;
250 250
 			};
251 251
 			name = Release;
@@ -253,7 +253,7 @@
253 253
 /* End XCBuildConfiguration section */
254 254
 
255 255
 /* Begin XCConfigurationList section */
256
-		58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RCTWebView" */ = {
256
+		58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNCWebView" */ = {
257 257
 			isa = XCConfigurationList;
258 258
 			buildConfigurations = (
259 259
 				58B511ED1A9E6C8500147676 /* Debug */,
@@ -262,7 +262,7 @@
262 262
 			defaultConfigurationIsVisible = 0;
263 263
 			defaultConfigurationName = Release;
264 264
 		};
265
-		58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RCTWebView" */ = {
265
+		58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNCWebView" */ = {
266 266
 			isa = XCConfigurationList;
267 267
 			buildConfigurations = (
268 268
 				58B511F01A9E6C8500147676 /* Debug */,