@javascriptcommon/react-native-webview 13.12.21 → 13.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/gradle.properties +1 -1
- package/android/src/main/AndroidManifest.xml +12 -0
- package/android/src/main/AndroidManifestNew.xml +13 -0
- package/android/src/main/assets/contentfilter/rules.txt +57751 -0
- package/android/src/main/java/com/reactnativecommunity/webview/ContentFilter.kt +85 -0
- package/android/src/main/java/com/reactnativecommunity/webview/RNCWebView.java +76 -25
- package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewClient.java +168 -25
- package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManagerImpl.kt +15 -7
- package/android/src/main/java/com/reactnativecommunity/webview/events/SubResourceErrorEvent.kt +25 -0
- package/android/src/main/jniLibs/arm64-v8a/libcontentfilter.so +0 -0
- package/android/src/main/jniLibs/armeabi-v7a/libcontentfilter.so +0 -0
- package/android/src/main/jniLibs/x86_64/libcontentfilter.so +0 -0
- package/android/src/newarch/com/reactnativecommunity/webview/RNCWebViewManager.java +12 -1
- package/android/src/oldarch/com/reactnativecommunity/webview/RNCWebViewManager.java +7 -0
- package/apple/RNCWebView.h +1 -1
- package/apple/RNCWebView.mm +26 -17
- package/apple/RNCWebViewImpl.h +2 -1
- package/apple/RNCWebViewImpl.m +62 -25
- package/apple/RNCWebViewManager.mm +4 -0
- package/index.d.ts +2 -3
- package/lib/RNCWebViewNativeComponent.d.ts +24 -21
- package/lib/RNCWebViewNativeComponent.js +1 -1
- package/lib/WebView.android.js +1 -1
- package/lib/WebViewShared.d.ts +3 -1
- package/lib/WebViewShared.js +1 -1
- package/lib/WebViewTypes.d.ts +32 -8
- package/package.json +9 -1
- package/src/RNCWebViewNativeComponent.ts +27 -21
- package/src/WebView.android.tsx +4 -0
- package/src/WebViewShared.tsx +10 -0
- package/src/WebViewTypes.ts +36 -8
|
@@ -11,6 +11,7 @@ import com.facebook.react.uimanager.ViewGroupManager;
|
|
|
11
11
|
import com.facebook.react.uimanager.annotations.ReactProp;
|
|
12
12
|
import com.facebook.react.views.scroll.ScrollEventType;
|
|
13
13
|
import com.reactnativecommunity.webview.events.TopCustomMenuSelectionEvent;
|
|
14
|
+
import com.reactnativecommunity.webview.events.SubResourceErrorEvent;
|
|
14
15
|
import com.reactnativecommunity.webview.events.TopHttpErrorEvent;
|
|
15
16
|
import com.reactnativecommunity.webview.events.TopLoadingErrorEvent;
|
|
16
17
|
import com.reactnativecommunity.webview.events.TopLoadingFinishEvent;
|
|
@@ -278,6 +279,11 @@ public class RNCWebViewManager extends ViewGroupManager<RNCWebViewWrapper> {
|
|
|
278
279
|
mRNCWebViewManagerImpl.setUserAgent(view, value);
|
|
279
280
|
}
|
|
280
281
|
|
|
282
|
+
@ReactProp(name = "paymentRequestEnabled")
|
|
283
|
+
public void setPaymentRequestEnabled(RNCWebViewWrapper view, boolean value) {
|
|
284
|
+
mRNCWebViewManagerImpl.setPaymentRequestEnabled(view, value);
|
|
285
|
+
}
|
|
286
|
+
|
|
281
287
|
@Override
|
|
282
288
|
protected void addEventEmitters(@NonNull ThemedReactContext reactContext, RNCWebViewWrapper viewWrapper) {
|
|
283
289
|
// Do not register default touch emitter and let WebView implementation handle touches
|
|
@@ -294,6 +300,7 @@ public class RNCWebViewManager extends ViewGroupManager<RNCWebViewWrapper> {
|
|
|
294
300
|
export.put(TopLoadingStartEvent.EVENT_NAME, MapBuilder.of("registrationName", "onLoadingStart"));
|
|
295
301
|
export.put(TopLoadingFinishEvent.EVENT_NAME, MapBuilder.of("registrationName", "onLoadingFinish"));
|
|
296
302
|
export.put(TopLoadingErrorEvent.EVENT_NAME, MapBuilder.of("registrationName", "onLoadingError"));
|
|
303
|
+
export.put(SubResourceErrorEvent.EVENT_NAME, MapBuilder.of("registrationName", "onLoadingSubResourceError"));
|
|
297
304
|
export.put(TopMessageEvent.EVENT_NAME, MapBuilder.of("registrationName", "onMessage"));
|
|
298
305
|
// !Default events but adding them here explicitly for clarity
|
|
299
306
|
|
package/apple/RNCWebView.h
CHANGED
|
@@ -22,7 +22,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
22
22
|
|
|
23
23
|
namespace facebook {
|
|
24
24
|
namespace react {
|
|
25
|
-
bool operator==(const RNCWebViewMenuItemsStruct& a, const RNCWebViewMenuItemsStruct& b)
|
|
25
|
+
inline bool operator==(const RNCWebViewMenuItemsStruct& a, const RNCWebViewMenuItemsStruct& b)
|
|
26
26
|
{
|
|
27
27
|
return b.key == a.key && b.label == a.label;
|
|
28
28
|
}
|
package/apple/RNCWebView.mm
CHANGED
|
@@ -71,9 +71,9 @@ auto stringToOnLoadingFinishNavigationTypeEnum(std::string value) {
|
|
|
71
71
|
if (self = [super initWithFrame:frame]) {
|
|
72
72
|
static const auto defaultProps = std::make_shared<const RNCWebViewProps>();
|
|
73
73
|
_props = defaultProps;
|
|
74
|
-
|
|
74
|
+
|
|
75
75
|
_view = [[RNCWebViewImpl alloc] init];
|
|
76
|
-
|
|
76
|
+
|
|
77
77
|
_view.onShouldStartLoadWithRequest = [self](NSDictionary* dictionary) {
|
|
78
78
|
if (_eventEmitter) {
|
|
79
79
|
auto webViewEventEmitter = std::static_pointer_cast<RNCWebViewEventEmitter const>(_eventEmitter);
|
|
@@ -83,7 +83,7 @@ auto stringToOnLoadingFinishNavigationTypeEnum(std::string value) {
|
|
|
83
83
|
.title = std::string([[dictionary valueForKey:@"title"] UTF8String]),
|
|
84
84
|
.navigationType = stringToOnShouldStartLoadWithRequestNavigationTypeEnum(std::string([[dictionary valueForKey:@"navigationType"] UTF8String])),
|
|
85
85
|
.canGoBack = static_cast<bool>([[dictionary valueForKey:@"canGoBack"] boolValue]),
|
|
86
|
-
.canGoForward = static_cast<bool>([[dictionary valueForKey:@"
|
|
86
|
+
.canGoForward = static_cast<bool>([[dictionary valueForKey:@"canGoForward"] boolValue]),
|
|
87
87
|
.isTopFrame = static_cast<bool>([[dictionary valueForKey:@"isTopFrame"] boolValue]),
|
|
88
88
|
.loading = static_cast<bool>([[dictionary valueForKey:@"loading"] boolValue]),
|
|
89
89
|
.mainDocumentURL = std::string([[dictionary valueForKey:@"mainDocumentURL"] UTF8String])
|
|
@@ -100,7 +100,7 @@ auto stringToOnLoadingFinishNavigationTypeEnum(std::string value) {
|
|
|
100
100
|
.title = std::string([[dictionary valueForKey:@"title"] UTF8String]),
|
|
101
101
|
.navigationType = stringToOnLoadingStartNavigationTypeEnum(std::string([[dictionary valueForKey:@"navigationType"] UTF8String])),
|
|
102
102
|
.canGoBack = static_cast<bool>([[dictionary valueForKey:@"canGoBack"] boolValue]),
|
|
103
|
-
.canGoForward = static_cast<bool>([[dictionary valueForKey:@"
|
|
103
|
+
.canGoForward = static_cast<bool>([[dictionary valueForKey:@"canGoForward"] boolValue]),
|
|
104
104
|
.loading = static_cast<bool>([[dictionary valueForKey:@"loading"] boolValue]),
|
|
105
105
|
.mainDocumentURL = std::string([[dictionary valueForKey:@"mainDocumentURL"] UTF8String], [[dictionary valueForKey:@"mainDocumentURL"] lengthOfBytesUsingEncoding:NSUTF8StringEncoding])
|
|
106
106
|
};
|
|
@@ -117,7 +117,7 @@ auto stringToOnLoadingFinishNavigationTypeEnum(std::string value) {
|
|
|
117
117
|
.code = [[dictionary valueForKey:@"code"] intValue],
|
|
118
118
|
.description = std::string([[dictionary valueForKey:@"description"] UTF8String] ?: ""),
|
|
119
119
|
.canGoBack = static_cast<bool>([[dictionary valueForKey:@"canGoBack"] boolValue]),
|
|
120
|
-
.canGoForward = static_cast<bool>([[dictionary valueForKey:@"
|
|
120
|
+
.canGoForward = static_cast<bool>([[dictionary valueForKey:@"canGoForward"] boolValue]),
|
|
121
121
|
.loading = static_cast<bool>([[dictionary valueForKey:@"loading"] boolValue]),
|
|
122
122
|
.domain = std::string([[dictionary valueForKey:@"domain"] UTF8String])
|
|
123
123
|
};
|
|
@@ -132,7 +132,7 @@ auto stringToOnLoadingFinishNavigationTypeEnum(std::string value) {
|
|
|
132
132
|
.lockIdentifier = [[dictionary valueForKey:@"lockIdentifier"] doubleValue],
|
|
133
133
|
.title = std::string([[dictionary valueForKey:@"title"] UTF8String]),
|
|
134
134
|
.canGoBack = static_cast<bool>([[dictionary valueForKey:@"canGoBack"] boolValue]),
|
|
135
|
-
.canGoForward = static_cast<bool>([[dictionary valueForKey:@"
|
|
135
|
+
.canGoForward = static_cast<bool>([[dictionary valueForKey:@"canGoForward"] boolValue]),
|
|
136
136
|
.loading = static_cast<bool>([[dictionary valueForKey:@"loading"] boolValue]),
|
|
137
137
|
.data = std::string([[dictionary valueForKey:@"data"] UTF8String])
|
|
138
138
|
};
|
|
@@ -148,7 +148,7 @@ auto stringToOnLoadingFinishNavigationTypeEnum(std::string value) {
|
|
|
148
148
|
.title = std::string([[dictionary valueForKey:@"title"] UTF8String]),
|
|
149
149
|
.navigationType = stringToOnLoadingFinishNavigationTypeEnum(std::string([[dictionary valueForKey:@"navigationType"] UTF8String], [[dictionary valueForKey:@"navigationType"] lengthOfBytesUsingEncoding:NSUTF8StringEncoding])),
|
|
150
150
|
.canGoBack = static_cast<bool>([[dictionary valueForKey:@"canGoBack"] boolValue]),
|
|
151
|
-
.canGoForward = static_cast<bool>([[dictionary valueForKey:@"
|
|
151
|
+
.canGoForward = static_cast<bool>([[dictionary valueForKey:@"canGoForward"] boolValue]),
|
|
152
152
|
.loading = static_cast<bool>([[dictionary valueForKey:@"loading"] boolValue]),
|
|
153
153
|
.mainDocumentURL = std::string([[dictionary valueForKey:@"mainDocumentURL"] UTF8String], [[dictionary valueForKey:@"mainDocumentURL"] lengthOfBytesUsingEncoding:NSUTF8StringEncoding])
|
|
154
154
|
};
|
|
@@ -163,7 +163,7 @@ auto stringToOnLoadingFinishNavigationTypeEnum(std::string value) {
|
|
|
163
163
|
.lockIdentifier = [[dictionary valueForKey:@"lockIdentifier"] doubleValue],
|
|
164
164
|
.title = std::string([[dictionary valueForKey:@"title"] UTF8String]),
|
|
165
165
|
.canGoBack = static_cast<bool>([[dictionary valueForKey:@"canGoBack"] boolValue]),
|
|
166
|
-
.canGoForward = static_cast<bool>([[dictionary valueForKey:@"
|
|
166
|
+
.canGoForward = static_cast<bool>([[dictionary valueForKey:@"canGoForward"] boolValue]),
|
|
167
167
|
.loading = static_cast<bool>([[dictionary valueForKey:@"loading"] boolValue]),
|
|
168
168
|
.progress = [[dictionary valueForKey:@"progress"] doubleValue]
|
|
169
169
|
};
|
|
@@ -178,7 +178,7 @@ auto stringToOnLoadingFinishNavigationTypeEnum(std::string value) {
|
|
|
178
178
|
.lockIdentifier = [[dictionary valueForKey:@"lockIdentifier"] doubleValue],
|
|
179
179
|
.title = std::string([[dictionary valueForKey:@"title"] UTF8String]),
|
|
180
180
|
.canGoBack = static_cast<bool>([[dictionary valueForKey:@"canGoBack"] boolValue]),
|
|
181
|
-
.canGoForward = static_cast<bool>([[dictionary valueForKey:@"
|
|
181
|
+
.canGoForward = static_cast<bool>([[dictionary valueForKey:@"canGoForward"] boolValue]),
|
|
182
182
|
.loading = static_cast<bool>([[dictionary valueForKey:@"loading"] boolValue])
|
|
183
183
|
};
|
|
184
184
|
webViewEventEmitter->onContentProcessDidTerminate(data);
|
|
@@ -191,7 +191,7 @@ auto stringToOnLoadingFinishNavigationTypeEnum(std::string value) {
|
|
|
191
191
|
.selectedText = std::string([[dictionary valueForKey:@"selectedText"] UTF8String]),
|
|
192
192
|
.key = std::string([[dictionary valueForKey:@"key"] UTF8String]),
|
|
193
193
|
.label = std::string([[dictionary valueForKey:@"label"] UTF8String])
|
|
194
|
-
|
|
194
|
+
|
|
195
195
|
};
|
|
196
196
|
webViewEventEmitter->onCustomMenuSelection(data);
|
|
197
197
|
}
|
|
@@ -238,7 +238,7 @@ auto stringToOnLoadingFinishNavigationTypeEnum(std::string value) {
|
|
|
238
238
|
.statusCode = [[dictionary valueForKey:@"statusCode"] intValue],
|
|
239
239
|
.description = std::string([[dictionary valueForKey:@"description"] UTF8String] ?: ""),
|
|
240
240
|
.canGoBack = static_cast<bool>([[dictionary valueForKey:@"canGoBack"] boolValue]),
|
|
241
|
-
.canGoForward = static_cast<bool>([[dictionary valueForKey:@"
|
|
241
|
+
.canGoForward = static_cast<bool>([[dictionary valueForKey:@"canGoForward"] boolValue]),
|
|
242
242
|
.loading = static_cast<bool>([[dictionary valueForKey:@"loading"] boolValue])
|
|
243
243
|
};
|
|
244
244
|
webViewEventEmitter->onHttpError(data);
|
|
@@ -313,7 +313,7 @@ auto stringToOnLoadingFinishNavigationTypeEnum(std::string value) {
|
|
|
313
313
|
REMAP_WEBVIEW_PROP(showsHorizontalScrollIndicator)
|
|
314
314
|
REMAP_WEBVIEW_PROP(showsVerticalScrollIndicator)
|
|
315
315
|
REMAP_WEBVIEW_PROP(keyboardDisplayRequiresUserAction)
|
|
316
|
-
|
|
316
|
+
|
|
317
317
|
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* __IPHONE_13_0 */
|
|
318
318
|
REMAP_WEBVIEW_PROP(automaticallyAdjustContentInsets)
|
|
319
319
|
#endif
|
|
@@ -399,7 +399,7 @@ auto stringToOnLoadingFinishNavigationTypeEnum(std::string value) {
|
|
|
399
399
|
for (const auto &menuItem: newViewProps.suppressMenuItems) {
|
|
400
400
|
[suppressMenuItems addObject: RCTNSStringFromString(menuItem)];
|
|
401
401
|
}
|
|
402
|
-
|
|
402
|
+
|
|
403
403
|
[_view setSuppressMenuItems:suppressMenuItems];
|
|
404
404
|
}
|
|
405
405
|
if (oldViewProps.hasOnFileDownload != newViewProps.hasOnFileDownload) {
|
|
@@ -411,10 +411,10 @@ auto stringToOnLoadingFinishNavigationTypeEnum(std::string value) {
|
|
|
411
411
|
.downloadUrl = std::string([[dictionary valueForKey:@"downloadUrl"] UTF8String])
|
|
412
412
|
};
|
|
413
413
|
webViewEventEmitter->onFileDownload(data);
|
|
414
|
-
}
|
|
414
|
+
}
|
|
415
415
|
};
|
|
416
416
|
} else {
|
|
417
|
-
_view.onFileDownload = nil;
|
|
417
|
+
_view.onFileDownload = nil;
|
|
418
418
|
}
|
|
419
419
|
}
|
|
420
420
|
if (oldViewProps.hasOnOpenWindowEvent != newViewProps.hasOnOpenWindowEvent) {
|
|
@@ -460,7 +460,16 @@ auto stringToOnLoadingFinishNavigationTypeEnum(std::string value) {
|
|
|
460
460
|
}
|
|
461
461
|
}
|
|
462
462
|
#endif
|
|
463
|
-
|
|
463
|
+
if (oldViewProps.indicatorStyle != newViewProps.indicatorStyle) {
|
|
464
|
+
if (newViewProps.indicatorStyle == RNCWebViewIndicatorStyle::Black) {
|
|
465
|
+
[_view setIndicatorStyle:@"black"];
|
|
466
|
+
} else if (newViewProps.indicatorStyle == RNCWebViewIndicatorStyle::White) {
|
|
467
|
+
[_view setIndicatorStyle:@"white"];
|
|
468
|
+
} else {
|
|
469
|
+
[_view setIndicatorStyle:@"default"];
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
|
|
464
473
|
NSMutableDictionary* source = [[NSMutableDictionary alloc] init];
|
|
465
474
|
if (!newViewProps.newSource.uri.empty()) {
|
|
466
475
|
[source setValue:RCTNSStringFromString(newViewProps.newSource.uri) forKey:@"uri"];
|
|
@@ -485,7 +494,7 @@ auto stringToOnLoadingFinishNavigationTypeEnum(std::string value) {
|
|
|
485
494
|
[source setValue:RCTNSStringFromString(newViewProps.newSource.method) forKey:@"method"];
|
|
486
495
|
}
|
|
487
496
|
[_view setSource:source];
|
|
488
|
-
|
|
497
|
+
|
|
489
498
|
[super updateProps:props oldProps:oldProps];
|
|
490
499
|
}
|
|
491
500
|
|
package/apple/RNCWebViewImpl.h
CHANGED
|
@@ -45,7 +45,7 @@ shouldStartLoadForRequest:(NSMutableDictionary<NSString *, id> *)request
|
|
|
45
45
|
@end
|
|
46
46
|
|
|
47
47
|
#if !TARGET_OS_OSX
|
|
48
|
-
@interface RNCWebViewImpl : RCTView <UIEditMenuInteractionDelegate>
|
|
48
|
+
@interface RNCWebViewImpl : RCTView <UIEditMenuInteractionDelegate, UIGestureRecognizerDelegate>
|
|
49
49
|
|
|
50
50
|
@property (nonatomic, nullable) UIEditMenuInteraction *editMenuInteraction API_AVAILABLE(ios(16.0));
|
|
51
51
|
#else
|
|
@@ -103,6 +103,7 @@ shouldStartLoadForRequest:(NSMutableDictionary<NSString *, id> *)request
|
|
|
103
103
|
@property (nonatomic, assign) BOOL allowsLinkPreview;
|
|
104
104
|
@property (nonatomic, assign) BOOL showsHorizontalScrollIndicator;
|
|
105
105
|
@property (nonatomic, assign) BOOL showsVerticalScrollIndicator;
|
|
106
|
+
@property (nonatomic, copy) NSString * _Nullable indicatorStyle;
|
|
106
107
|
@property (nonatomic, assign) BOOL directionalLockEnabled;
|
|
107
108
|
@property (nonatomic, assign) BOOL ignoreSilentHardwareSwitch;
|
|
108
109
|
@property (nonatomic, copy) NSString * _Nullable allowingReadAccessToURL;
|
package/apple/RNCWebViewImpl.m
CHANGED
|
@@ -74,7 +74,7 @@ NSString *const CUSTOM_SELECTOR = @"_CUSTOM_SELECTOR_";
|
|
|
74
74
|
@"toggleUnderline:": @"underline",
|
|
75
75
|
@"_share:": @"share",
|
|
76
76
|
};
|
|
77
|
-
|
|
77
|
+
|
|
78
78
|
return map[sel] ?: sel;
|
|
79
79
|
}
|
|
80
80
|
|
|
@@ -86,7 +86,7 @@ NSString *const CUSTOM_SELECTOR = @"_CUSTOM_SELECTOR_";
|
|
|
86
86
|
return NO;
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
-
|
|
89
|
+
|
|
90
90
|
if (!self.menuItems) {
|
|
91
91
|
return [super canPerformAction:action withSender:sender];
|
|
92
92
|
}
|
|
@@ -166,28 +166,36 @@ RCTAutoInsetsProtocol>
|
|
|
166
166
|
_bounces = YES;
|
|
167
167
|
_scrollEnabled = YES;
|
|
168
168
|
_showsHorizontalScrollIndicator = YES;
|
|
169
|
+
_javaScriptEnabled = YES;
|
|
170
|
+
_allowsLinkPreview = YES;
|
|
169
171
|
_showsVerticalScrollIndicator = YES;
|
|
170
172
|
_directionalLockEnabled = YES;
|
|
173
|
+
_useSharedProcessPool = YES;
|
|
174
|
+
_cacheEnabled = YES;
|
|
175
|
+
_mediaPlaybackRequiresUserAction = YES;
|
|
171
176
|
_automaticallyAdjustContentInsets = YES;
|
|
172
177
|
_autoManageStatusBarEnabled = YES;
|
|
173
178
|
_contentInset = UIEdgeInsetsZero;
|
|
174
179
|
_savedKeyboardDisplayRequiresUserAction = YES;
|
|
175
|
-
#if TARGET_OS_IOS
|
|
176
|
-
_savedStatusBarStyle = RCTSharedApplication().statusBarStyle;
|
|
177
|
-
_savedStatusBarHidden = RCTSharedApplication().statusBarHidden;
|
|
178
|
-
#endif // TARGET_OS_IOS
|
|
179
180
|
_injectedJavaScript = nil;
|
|
180
181
|
_injectedJavaScriptForMainFrameOnly = YES;
|
|
181
182
|
_injectedJavaScriptBeforeContentLoaded = nil;
|
|
182
183
|
_injectedJavaScriptBeforeContentLoadedForMainFrameOnly = YES;
|
|
183
|
-
|
|
184
|
+
_enableApplePay = NO;
|
|
185
|
+
#if TARGET_OS_IOS
|
|
186
|
+
_savedStatusBarStyle = RCTSharedApplication().statusBarStyle;
|
|
187
|
+
_savedStatusBarHidden = RCTSharedApplication().statusBarHidden;
|
|
188
|
+
#endif // TARGET_OS_IOS
|
|
184
189
|
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */
|
|
185
190
|
_savedContentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
|
186
191
|
#endif
|
|
187
192
|
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* __IPHONE_13_0 */
|
|
188
193
|
_savedAutomaticallyAdjustsScrollIndicatorInsets = NO;
|
|
194
|
+
_fraudulentWebsiteWarningEnabled = YES;
|
|
195
|
+
#endif
|
|
196
|
+
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 140500 /* __IPHONE_13_0 */
|
|
197
|
+
_textInteractionEnabled = YES;
|
|
189
198
|
#endif
|
|
190
|
-
_enableApplePay = NO;
|
|
191
199
|
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 150000 /* iOS 15 */
|
|
192
200
|
_mediaCapturePermissionGrantType = RNCWebViewPermissionGrantType_Prompt;
|
|
193
201
|
#endif
|
|
@@ -269,7 +277,7 @@ RCTAutoInsetsProtocol>
|
|
|
269
277
|
|
|
270
278
|
UIMenuController *menuController = [UIMenuController sharedMenuController];
|
|
271
279
|
NSMutableArray *menuControllerItems = [NSMutableArray arrayWithCapacity:self.menuItems.count];
|
|
272
|
-
|
|
280
|
+
|
|
273
281
|
for(NSDictionary *menuItem in self.menuItems) {
|
|
274
282
|
NSString *menuItemLabel = [RCTConvert NSString:menuItem[@"label"]];
|
|
275
283
|
NSString *menuItemKey = [RCTConvert NSString:menuItem[@"key"]];
|
|
@@ -559,6 +567,15 @@ RCTAutoInsetsProtocol>
|
|
|
559
567
|
_webView.scrollView.bounces = _pullToRefreshEnabled || _bounces;
|
|
560
568
|
_webView.scrollView.showsHorizontalScrollIndicator = _showsHorizontalScrollIndicator;
|
|
561
569
|
_webView.scrollView.showsVerticalScrollIndicator = _showsVerticalScrollIndicator;
|
|
570
|
+
|
|
571
|
+
if ([_indicatorStyle isEqualToString:@"black"]) {
|
|
572
|
+
_webView.scrollView.indicatorStyle = UIScrollViewIndicatorStyleBlack;
|
|
573
|
+
} else if ([_indicatorStyle isEqualToString:@"white"]) {
|
|
574
|
+
_webView.scrollView.indicatorStyle = UIScrollViewIndicatorStyleWhite;
|
|
575
|
+
} else {
|
|
576
|
+
_webView.scrollView.indicatorStyle = UIScrollViewIndicatorStyleDefault;
|
|
577
|
+
}
|
|
578
|
+
|
|
562
579
|
_webView.scrollView.directionalLockEnabled = _directionalLockEnabled;
|
|
563
580
|
#endif // !TARGET_OS_OSX
|
|
564
581
|
_webView.allowsLinkPreview = _allowsLinkPreview;
|
|
@@ -806,6 +823,7 @@ RCTAutoInsetsProtocol>
|
|
|
806
823
|
if (_onMessage) {
|
|
807
824
|
NSMutableDictionary<NSString *, id> *event = [self baseEvent];
|
|
808
825
|
[event addEntriesFromDictionary: @{@"data": message.body}];
|
|
826
|
+
[event addEntriesFromDictionary: @{@"url": message.frameInfo.request.URL.absoluteString}];
|
|
809
827
|
_onMessage(event);
|
|
810
828
|
}
|
|
811
829
|
}
|
|
@@ -833,22 +851,25 @@ RCTAutoInsetsProtocol>
|
|
|
833
851
|
}
|
|
834
852
|
}
|
|
835
853
|
|
|
836
|
-
#if !TARGET_OS_OSX
|
|
837
854
|
- (void)setContentInset:(UIEdgeInsets)contentInset
|
|
838
855
|
{
|
|
856
|
+
#if !TARGET_OS_OSX
|
|
839
857
|
_contentInset = contentInset;
|
|
840
858
|
[RCTView autoAdjustInsetsForView:self
|
|
841
859
|
withScrollView:_webView.scrollView
|
|
842
860
|
updateOffset:NO];
|
|
861
|
+
#endif // !TARGET_OS_OSX
|
|
843
862
|
}
|
|
844
863
|
|
|
845
864
|
- (void)refreshContentInset
|
|
846
865
|
{
|
|
866
|
+
#if !TARGET_OS_OSX
|
|
847
867
|
[RCTView autoAdjustInsetsForView:self
|
|
848
868
|
withScrollView:_webView.scrollView
|
|
849
869
|
updateOffset:YES];
|
|
850
|
-
}
|
|
851
870
|
#endif // !TARGET_OS_OSX
|
|
871
|
+
}
|
|
872
|
+
|
|
852
873
|
|
|
853
874
|
- (void)visitSource
|
|
854
875
|
{
|
|
@@ -878,7 +899,7 @@ RCTAutoInsetsProtocol>
|
|
|
878
899
|
[self syncCookiesToWebView:^{
|
|
879
900
|
// Add observer to sync cookies from webview to sharedHTTPCookieStorage
|
|
880
901
|
[webView.configuration.websiteDataStore.httpCookieStore addObserver:self];
|
|
881
|
-
|
|
902
|
+
|
|
882
903
|
// Because of the way React works, as pages redirect, we actually end up
|
|
883
904
|
// passing the redirect urls back here, so we ignore them if trying to load
|
|
884
905
|
// the same url. We'll expose a call to 'reload' to allow a user to load
|
|
@@ -915,6 +936,7 @@ RCTAutoInsetsProtocol>
|
|
|
915
936
|
#if TARGET_OS_IOS
|
|
916
937
|
-(void)setKeyboardDisplayRequiresUserAction:(BOOL)keyboardDisplayRequiresUserAction
|
|
917
938
|
{
|
|
939
|
+
_keyboardDisplayRequiresUserAction = keyboardDisplayRequiresUserAction;
|
|
918
940
|
if (_webView == nil) {
|
|
919
941
|
_savedKeyboardDisplayRequiresUserAction = keyboardDisplayRequiresUserAction;
|
|
920
942
|
return;
|
|
@@ -947,7 +969,7 @@ RCTAutoInsetsProtocol>
|
|
|
947
969
|
SEL selector = sel_getUid("_elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:");
|
|
948
970
|
method = class_getInstanceMethod(class, selector);
|
|
949
971
|
IMP original = method_getImplementation(method);
|
|
950
|
-
override = imp_implementationWithBlock(^void(id me, void* arg0, BOOL arg1, BOOL arg2, BOOL arg3, id arg4) {
|
|
972
|
+
override = imp_implementationWithBlock(^void(id me, void* arg0, __unused BOOL arg1, BOOL arg2, BOOL arg3, id arg4) {
|
|
951
973
|
((void (*)(id, SEL, void*, BOOL, BOOL, BOOL, id))original)(me, selector, arg0, TRUE, arg2, arg3, arg4);
|
|
952
974
|
});
|
|
953
975
|
}
|
|
@@ -956,7 +978,7 @@ RCTAutoInsetsProtocol>
|
|
|
956
978
|
SEL selector = sel_getUid("_elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:");
|
|
957
979
|
method = class_getInstanceMethod(class, selector);
|
|
958
980
|
IMP original = method_getImplementation(method);
|
|
959
|
-
override = imp_implementationWithBlock(^void(id me, void* arg0, BOOL arg1, BOOL arg2, BOOL arg3, id arg4) {
|
|
981
|
+
override = imp_implementationWithBlock(^void(id me, void* arg0, __unused BOOL arg1, BOOL arg2, BOOL arg3, id arg4) {
|
|
960
982
|
((void (*)(id, SEL, void*, BOOL, BOOL, BOOL, id))original)(me, selector, arg0, TRUE, arg2, arg3, arg4);
|
|
961
983
|
});
|
|
962
984
|
}
|
|
@@ -965,7 +987,7 @@ RCTAutoInsetsProtocol>
|
|
|
965
987
|
SEL selector = sel_getUid("_startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:");
|
|
966
988
|
method = class_getInstanceMethod(class, selector);
|
|
967
989
|
IMP original = method_getImplementation(method);
|
|
968
|
-
override = imp_implementationWithBlock(^void(id me, void* arg0, BOOL arg1, BOOL arg2, BOOL arg3, id arg4) {
|
|
990
|
+
override = imp_implementationWithBlock(^void(id me, void* arg0, __unused BOOL arg1, BOOL arg2, BOOL arg3, id arg4) {
|
|
969
991
|
((void (*)(id, SEL, void*, BOOL, BOOL, BOOL, id))original)(me, selector, arg0, TRUE, arg2, arg3, arg4);
|
|
970
992
|
});
|
|
971
993
|
} else {
|
|
@@ -973,7 +995,7 @@ RCTAutoInsetsProtocol>
|
|
|
973
995
|
SEL selector = sel_getUid("_startAssistingNode:userIsInteracting:blurPreviousNode:userObject:");
|
|
974
996
|
method = class_getInstanceMethod(class, selector);
|
|
975
997
|
IMP original = method_getImplementation(method);
|
|
976
|
-
override = imp_implementationWithBlock(^void(id me, void* arg0, BOOL arg1, BOOL arg2, id arg3) {
|
|
998
|
+
override = imp_implementationWithBlock(^void(id me, void* arg0, __unused BOOL arg1, BOOL arg2, id arg3) {
|
|
977
999
|
((void (*)(id, SEL, void*, BOOL, BOOL, id))original)(me, selector, arg0, TRUE, arg2, arg3);
|
|
978
1000
|
});
|
|
979
1001
|
}
|
|
@@ -983,6 +1005,7 @@ RCTAutoInsetsProtocol>
|
|
|
983
1005
|
|
|
984
1006
|
-(void)setHideKeyboardAccessoryView:(BOOL)hideKeyboardAccessoryView
|
|
985
1007
|
{
|
|
1008
|
+
_hideKeyboardAccessoryView = hideKeyboardAccessoryView;
|
|
986
1009
|
_savedHideKeyboardAccessoryView = hideKeyboardAccessoryView;
|
|
987
1010
|
|
|
988
1011
|
if (_webView == nil) {
|
|
@@ -1108,6 +1131,19 @@ RCTAutoInsetsProtocol>
|
|
|
1108
1131
|
_showsVerticalScrollIndicator = showsVerticalScrollIndicator;
|
|
1109
1132
|
_webView.scrollView.showsVerticalScrollIndicator = showsVerticalScrollIndicator;
|
|
1110
1133
|
}
|
|
1134
|
+
|
|
1135
|
+
- (void)setIndicatorStyle:(NSString *)indicatorStyle
|
|
1136
|
+
{
|
|
1137
|
+
_indicatorStyle = indicatorStyle;
|
|
1138
|
+
|
|
1139
|
+
if ([indicatorStyle isEqualToString:@"black"]) {
|
|
1140
|
+
_webView.scrollView.indicatorStyle = UIScrollViewIndicatorStyleBlack;
|
|
1141
|
+
} else if ([indicatorStyle isEqualToString:@"white"]) {
|
|
1142
|
+
_webView.scrollView.indicatorStyle = UIScrollViewIndicatorStyleWhite;
|
|
1143
|
+
} else {
|
|
1144
|
+
_webView.scrollView.indicatorStyle = UIScrollViewIndicatorStyleDefault;
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1111
1147
|
#endif // !TARGET_OS_OSX
|
|
1112
1148
|
|
|
1113
1149
|
- (void)postMessage:(NSString *)message
|
|
@@ -1205,7 +1241,7 @@ RCTAutoInsetsProtocol>
|
|
|
1205
1241
|
{
|
|
1206
1242
|
#if !TARGET_OS_OSX
|
|
1207
1243
|
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"" message:message preferredStyle:UIAlertControllerStyleAlert];
|
|
1208
|
-
[alert addAction:[UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
|
|
1244
|
+
[alert addAction:[UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDefault handler:^(__unused UIAlertAction *action) {
|
|
1209
1245
|
completionHandler();
|
|
1210
1246
|
}]];
|
|
1211
1247
|
[[self topViewController] presentViewController:alert animated:YES completion:NULL];
|
|
@@ -1224,10 +1260,10 @@ RCTAutoInsetsProtocol>
|
|
|
1224
1260
|
- (void)webView:(WKWebView *)webView runJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(BOOL))completionHandler{
|
|
1225
1261
|
#if !TARGET_OS_OSX
|
|
1226
1262
|
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"" message:message preferredStyle:UIAlertControllerStyleAlert];
|
|
1227
|
-
[alert addAction:[UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
|
|
1263
|
+
[alert addAction:[UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDefault handler:^(__unused UIAlertAction *action) {
|
|
1228
1264
|
completionHandler(YES);
|
|
1229
1265
|
}]];
|
|
1230
|
-
[alert addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
|
|
1266
|
+
[alert addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(__unused UIAlertAction *action) {
|
|
1231
1267
|
completionHandler(NO);
|
|
1232
1268
|
}]];
|
|
1233
1269
|
[[self topViewController] presentViewController:alert animated:YES completion:NULL];
|
|
@@ -1252,11 +1288,11 @@ RCTAutoInsetsProtocol>
|
|
|
1252
1288
|
[alert addTextFieldWithConfigurationHandler:^(UITextField *textField) {
|
|
1253
1289
|
textField.text = defaultText;
|
|
1254
1290
|
}];
|
|
1255
|
-
UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
|
|
1291
|
+
UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDefault handler:^(__unused UIAlertAction *action) {
|
|
1256
1292
|
completionHandler([[alert.textFields lastObject] text]);
|
|
1257
1293
|
}];
|
|
1258
1294
|
[alert addAction:okAction];
|
|
1259
|
-
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
|
|
1295
|
+
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(__unused UIAlertAction *action) {
|
|
1260
1296
|
completionHandler(nil);
|
|
1261
1297
|
}];
|
|
1262
1298
|
[alert addAction:cancelAction];
|
|
@@ -1365,7 +1401,6 @@ RCTAutoInsetsProtocol>
|
|
|
1365
1401
|
}
|
|
1366
1402
|
|
|
1367
1403
|
if (_onShouldStartLoadWithRequest) {
|
|
1368
|
-
NSMutableDictionary<NSString *, id> *event = [self baseEvent];
|
|
1369
1404
|
int lockIdentifier = [[RNCWebViewDecisionManager getInstance] setDecisionHandler: ^(BOOL shouldStart){
|
|
1370
1405
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
1371
1406
|
if (!shouldStart) {
|
|
@@ -1389,6 +1424,7 @@ RCTAutoInsetsProtocol>
|
|
|
1389
1424
|
});
|
|
1390
1425
|
|
|
1391
1426
|
}];
|
|
1427
|
+
NSMutableDictionary<NSString *, id> *event = [self baseEvent];
|
|
1392
1428
|
if (request.mainDocumentURL) {
|
|
1393
1429
|
[event addEntriesFromDictionary: @{
|
|
1394
1430
|
@"mainDocumentURL": (request.mainDocumentURL).absoluteString,
|
|
@@ -1423,7 +1459,7 @@ RCTAutoInsetsProtocol>
|
|
|
1423
1459
|
}
|
|
1424
1460
|
|
|
1425
1461
|
/**
|
|
1426
|
-
* Called when the web view
|
|
1462
|
+
* Called when the web view's content process is terminated.
|
|
1427
1463
|
* @see https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455639-webviewwebcontentprocessdidtermi?language=objc
|
|
1428
1464
|
*/
|
|
1429
1465
|
- (void)webViewWebContentProcessDidTerminate:(WKWebView *)webView
|
|
@@ -1722,6 +1758,7 @@ didFinishNavigation:(WKNavigation *)navigation
|
|
|
1722
1758
|
|
|
1723
1759
|
- (void)setInjectedJavaScriptObject:(NSString *)source
|
|
1724
1760
|
{
|
|
1761
|
+
_injectedJavaScriptObject = source;
|
|
1725
1762
|
self.injectedObjectJsonScript = [
|
|
1726
1763
|
[WKUserScript alloc]
|
|
1727
1764
|
initWithSource: [
|
|
@@ -1860,8 +1897,8 @@ didFinishNavigation:(WKNavigation *)navigation
|
|
|
1860
1897
|
" })\n"
|
|
1861
1898
|
"})(window.history)\n", HistoryShimName
|
|
1862
1899
|
];
|
|
1863
|
-
WKUserScript *
|
|
1864
|
-
[wkWebViewConfig.userContentController addUserScript:
|
|
1900
|
+
WKUserScript *userScript = [[WKUserScript alloc] initWithSource:html5HistoryAPIShimSource injectionTime:WKUserScriptInjectionTimeAtDocumentStart forMainFrameOnly:YES];
|
|
1901
|
+
[wkWebViewConfig.userContentController addUserScript:userScript];
|
|
1865
1902
|
|
|
1866
1903
|
if(_sharedCookiesEnabled) {
|
|
1867
1904
|
// More info to sending cookies with WKWebView
|
|
@@ -168,6 +168,10 @@ RCT_CUSTOM_VIEW_PROPERTY(showsVerticalScrollIndicator, BOOL, RNCWebViewImpl) {
|
|
|
168
168
|
view.showsVerticalScrollIndicator = json == nil ? true : [RCTConvert BOOL: json];
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
+
RCT_CUSTOM_VIEW_PROPERTY(indicatorStyle, NSString, RNCWebViewImpl) {
|
|
172
|
+
view.indicatorStyle = [RCTConvert NSString: json];
|
|
173
|
+
}
|
|
174
|
+
|
|
171
175
|
RCT_CUSTOM_VIEW_PROPERTY(keyboardDisplayRequiresUserAction, BOOL, RNCWebViewImpl) {
|
|
172
176
|
view.keyboardDisplayRequiresUserAction = json == nil ? true : [RCTConvert BOOL: json];
|
|
173
177
|
}
|
package/index.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ declare class WebView<P = {}> extends Component<WebViewProps & P> {
|
|
|
33
33
|
injectJavaScript: (script: string) => void;
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
|
-
* Focuses on WebView
|
|
36
|
+
* Focuses on WebView rendered page.
|
|
37
37
|
*/
|
|
38
38
|
requestFocus: () => void;
|
|
39
39
|
|
|
@@ -49,10 +49,9 @@ declare class WebView<P = {}> extends Component<WebViewProps & P> {
|
|
|
49
49
|
clearFormData?: () => void;
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
|
-
* (Android only)
|
|
53
52
|
* Clears the resource cache. Note that the cache is per-application, so this will clear the cache for all WebViews used.
|
|
54
53
|
*/
|
|
55
|
-
clearCache
|
|
54
|
+
clearCache: (includeDiskFiles: boolean) => void;
|
|
56
55
|
|
|
57
56
|
/**
|
|
58
57
|
* (Android only)
|
|
@@ -131,22 +131,22 @@ export interface NativeProps extends ViewProps {
|
|
|
131
131
|
onRenderProcessGone?: DirectEventHandler<WebViewRenderProcessGoneEvent>;
|
|
132
132
|
overScrollMode?: string;
|
|
133
133
|
saveFormDataDisabled?: boolean;
|
|
134
|
-
scalesPageToFit?: boolean
|
|
135
|
-
setBuiltInZoomControls?: boolean
|
|
134
|
+
scalesPageToFit?: WithDefault<boolean, true>;
|
|
135
|
+
setBuiltInZoomControls?: WithDefault<boolean, true>;
|
|
136
136
|
setDisplayZoomControls?: boolean;
|
|
137
|
-
setSupportMultipleWindows?: boolean
|
|
137
|
+
setSupportMultipleWindows?: WithDefault<boolean, true>;
|
|
138
138
|
textZoom?: Int32;
|
|
139
|
-
thirdPartyCookiesEnabled?: boolean
|
|
139
|
+
thirdPartyCookiesEnabled?: WithDefault<boolean, true>;
|
|
140
140
|
hasOnScroll?: boolean;
|
|
141
141
|
allowingReadAccessToURL?: string;
|
|
142
142
|
allowsBackForwardNavigationGestures?: boolean;
|
|
143
143
|
allowsInlineMediaPlayback?: boolean;
|
|
144
144
|
allowsPictureInPictureMediaPlayback?: boolean;
|
|
145
145
|
allowsAirPlayForMediaPlayback?: boolean;
|
|
146
|
-
allowsLinkPreview?: boolean
|
|
147
|
-
automaticallyAdjustContentInsets?: boolean
|
|
148
|
-
autoManageStatusBarEnabled?: boolean
|
|
149
|
-
bounces?: boolean
|
|
146
|
+
allowsLinkPreview?: WithDefault<boolean, true>;
|
|
147
|
+
automaticallyAdjustContentInsets?: WithDefault<boolean, true>;
|
|
148
|
+
autoManageStatusBarEnabled?: WithDefault<boolean, true>;
|
|
149
|
+
bounces?: WithDefault<boolean, true>;
|
|
150
150
|
contentInset?: Readonly<{
|
|
151
151
|
top?: Double;
|
|
152
152
|
left?: Double;
|
|
@@ -157,19 +157,19 @@ export interface NativeProps extends ViewProps {
|
|
|
157
157
|
contentMode?: WithDefault<'recommended' | 'mobile' | 'desktop', 'recommended'>;
|
|
158
158
|
dataDetectorTypes?: WithDefault<ReadonlyArray<'address' | 'link' | 'calendarEvent' | 'trackingNumber' | 'flightNumber' | 'lookupSuggestion' | 'phoneNumber' | 'all' | 'none'>, 'phoneNumber'>;
|
|
159
159
|
decelerationRate?: Double;
|
|
160
|
-
directionalLockEnabled?: boolean
|
|
160
|
+
directionalLockEnabled?: WithDefault<boolean, true>;
|
|
161
161
|
enableApplePay?: boolean;
|
|
162
162
|
hideKeyboardAccessoryView?: boolean;
|
|
163
|
-
keyboardDisplayRequiresUserAction?: boolean
|
|
163
|
+
keyboardDisplayRequiresUserAction?: WithDefault<boolean, true>;
|
|
164
164
|
limitsNavigationsToAppBoundDomains?: boolean;
|
|
165
165
|
mediaCapturePermissionGrantType?: WithDefault<'prompt' | 'grant' | 'deny' | 'grantIfSameHostElsePrompt' | 'grantIfSameHostElseDeny', 'prompt'>;
|
|
166
166
|
pagingEnabled?: boolean;
|
|
167
167
|
pullToRefreshEnabled?: boolean;
|
|
168
168
|
refreshControlLightMode?: boolean;
|
|
169
|
-
scrollEnabled?: boolean
|
|
169
|
+
scrollEnabled?: WithDefault<boolean, true>;
|
|
170
170
|
sharedCookiesEnabled?: boolean;
|
|
171
|
-
textInteractionEnabled?: boolean
|
|
172
|
-
useSharedProcessPool?: boolean
|
|
171
|
+
textInteractionEnabled?: WithDefault<boolean, true>;
|
|
172
|
+
useSharedProcessPool?: WithDefault<boolean, true>;
|
|
173
173
|
onContentProcessDidTerminate?: DirectEventHandler<WebViewNativeEvent>;
|
|
174
174
|
onCustomMenuSelection?: DirectEventHandler<WebViewCustomMenuSelectionEvent>;
|
|
175
175
|
onFileDownload?: DirectEventHandler<WebViewDownloadEvent>;
|
|
@@ -179,7 +179,7 @@ export interface NativeProps extends ViewProps {
|
|
|
179
179
|
}>>;
|
|
180
180
|
suppressMenuItems?: Readonly<string>[];
|
|
181
181
|
hasOnFileDownload?: boolean;
|
|
182
|
-
fraudulentWebsiteWarningEnabled?: boolean
|
|
182
|
+
fraudulentWebsiteWarningEnabled?: WithDefault<boolean, true>;
|
|
183
183
|
allowFileAccessFromFileURLs?: boolean;
|
|
184
184
|
allowUniversalAccessFromFileURLs?: boolean;
|
|
185
185
|
applicationNameForUserAgent?: string;
|
|
@@ -187,19 +187,20 @@ export interface NativeProps extends ViewProps {
|
|
|
187
187
|
username: string;
|
|
188
188
|
password: string;
|
|
189
189
|
}>;
|
|
190
|
-
cacheEnabled?: boolean
|
|
190
|
+
cacheEnabled?: WithDefault<boolean, true>;
|
|
191
191
|
incognito?: boolean;
|
|
192
192
|
injectedJavaScript?: string;
|
|
193
193
|
injectedJavaScriptBeforeContentLoaded?: string;
|
|
194
|
-
injectedJavaScriptForMainFrameOnly?: boolean
|
|
195
|
-
injectedJavaScriptBeforeContentLoadedForMainFrameOnly?: boolean
|
|
194
|
+
injectedJavaScriptForMainFrameOnly?: WithDefault<boolean, true>;
|
|
195
|
+
injectedJavaScriptBeforeContentLoadedForMainFrameOnly?: WithDefault<boolean, true>;
|
|
196
196
|
javaScriptCanOpenWindowsAutomatically?: boolean;
|
|
197
|
-
javaScriptEnabled?: boolean
|
|
197
|
+
javaScriptEnabled?: WithDefault<boolean, true>;
|
|
198
198
|
webviewDebuggingEnabled?: boolean;
|
|
199
|
-
mediaPlaybackRequiresUserAction?: boolean
|
|
199
|
+
mediaPlaybackRequiresUserAction?: WithDefault<boolean, true>;
|
|
200
200
|
contentBlockerEnabled?: boolean;
|
|
201
201
|
messagingEnabled: boolean;
|
|
202
202
|
onLoadingError: DirectEventHandler<WebViewErrorEvent>;
|
|
203
|
+
onLoadingSubResourceError: DirectEventHandler<WebViewErrorEvent>;
|
|
203
204
|
onLoadingFinish: DirectEventHandler<WebViewNavigationEvent>;
|
|
204
205
|
onLoadingProgress: DirectEventHandler<WebViewNativeProgressEvent>;
|
|
205
206
|
onLoadingStart: DirectEventHandler<WebViewNavigationEvent>;
|
|
@@ -209,8 +210,9 @@ export interface NativeProps extends ViewProps {
|
|
|
209
210
|
hasOnOpenWindowEvent?: boolean;
|
|
210
211
|
onScroll?: DirectEventHandler<ScrollEvent>;
|
|
211
212
|
onShouldStartLoadWithRequest: DirectEventHandler<ShouldStartLoadRequestEvent>;
|
|
212
|
-
showsHorizontalScrollIndicator?: boolean
|
|
213
|
-
showsVerticalScrollIndicator?: boolean
|
|
213
|
+
showsHorizontalScrollIndicator?: WithDefault<boolean, true>;
|
|
214
|
+
showsVerticalScrollIndicator?: WithDefault<boolean, true>;
|
|
215
|
+
indicatorStyle?: WithDefault<'default' | 'black' | 'white', 'default'>;
|
|
214
216
|
newSource: Readonly<{
|
|
215
217
|
uri?: string;
|
|
216
218
|
method?: string;
|
|
@@ -224,6 +226,7 @@ export interface NativeProps extends ViewProps {
|
|
|
224
226
|
}>;
|
|
225
227
|
userAgent?: string;
|
|
226
228
|
injectedJavaScriptObject?: string;
|
|
229
|
+
paymentRequestEnabled?: boolean;
|
|
227
230
|
}
|
|
228
231
|
export interface NativeCommands {
|
|
229
232
|
goBack: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=exports.__INTERNAL_VIEW_CONFIG=exports.Commands=void 0;var _codegenNativeComponent=_interopRequireDefault(require("react-native/Libraries/Utilities/codegenNativeComponent"));var _codegenNativeCommands=_interopRequireDefault(require("react-native/Libraries/Utilities/codegenNativeCommands"));var NativeComponentRegistry=require('react-native/Libraries/NativeComponent/NativeComponentRegistry');var _require=require('react-native/Libraries/NativeComponent/ViewConfigIgnore'),ConditionallyIgnoredEventHandlers=_require.ConditionallyIgnoredEventHandlers;var _require2=require("react-native/Libraries/ReactNative/RendererProxy"),dispatchCommand=_require2.dispatchCommand;var nativeComponentName='RNCWebView';var __INTERNAL_VIEW_CONFIG=exports.__INTERNAL_VIEW_CONFIG={uiViewClassName:'RNCWebView',directEventTypes:{topContentSizeChange:{registrationName:'onContentSizeChange'},topRenderProcessGone:{registrationName:'onRenderProcessGone'},topContentProcessDidTerminate:{registrationName:'onContentProcessDidTerminate'},topCustomMenuSelection:{registrationName:'onCustomMenuSelection'},topFileDownload:{registrationName:'onFileDownload'},topLoadingError:{registrationName:'onLoadingError'},topLoadingFinish:{registrationName:'onLoadingFinish'},topLoadingProgress:{registrationName:'onLoadingProgress'},topLoadingStart:{registrationName:'onLoadingStart'},topHttpError:{registrationName:'onHttpError'},topMessage:{registrationName:'onMessage'},topOpenWindow:{registrationName:'onOpenWindow'},topScroll:{registrationName:'onScroll'},topShouldStartLoadWithRequest:{registrationName:'onShouldStartLoadWithRequest'}},validAttributes:Object.assign({allowFileAccess:true,allowsProtectedMedia:true,allowsFullscreenVideo:true,androidLayerType:true,cacheMode:true,domStorageEnabled:true,downloadingMessage:true,forceDarkOn:true,geolocationEnabled:true,lackPermissionToDownloadMessage:true,messagingModuleName:true,minimumFontSize:true,mixedContentMode:true,nestedScrollEnabled:true,overScrollMode:true,saveFormDataDisabled:true,scalesPageToFit:true,setBuiltInZoomControls:true,setDisplayZoomControls:true,setSupportMultipleWindows:true,textZoom:true,thirdPartyCookiesEnabled:true,hasOnScroll:true,allowingReadAccessToURL:true,allowsBackForwardNavigationGestures:true,allowsInlineMediaPlayback:true,allowsPictureInPictureMediaPlayback:true,allowsAirPlayForMediaPlayback:true,allowsLinkPreview:true,automaticallyAdjustContentInsets:true,autoManageStatusBarEnabled:true,bounces:true,contentInset:true,contentInsetAdjustmentBehavior:true,contentMode:true,dataDetectorTypes:true,decelerationRate:true,directionalLockEnabled:true,enableApplePay:true,hideKeyboardAccessoryView:true,keyboardDisplayRequiresUserAction:true,limitsNavigationsToAppBoundDomains:true,mediaCapturePermissionGrantType:true,pagingEnabled:true,pullToRefreshEnabled:true,refreshControlLightMode:true,scrollEnabled:true,sharedCookiesEnabled:true,textInteractionEnabled:true,useSharedProcessPool:true,menuItems:true,suppressMenuItems:true,hasOnFileDownload:true,fraudulentWebsiteWarningEnabled:true,allowFileAccessFromFileURLs:true,allowUniversalAccessFromFileURLs:true,applicationNameForUserAgent:true,basicAuthCredential:true,cacheEnabled:true,incognito:true,injectedJavaScript:true,injectedJavaScriptBeforeContentLoaded:true,injectedJavaScriptForMainFrameOnly:true,injectedJavaScriptBeforeContentLoadedForMainFrameOnly:true,javaScriptCanOpenWindowsAutomatically:true,javaScriptEnabled:true,webviewDebuggingEnabled:true,mediaPlaybackRequiresUserAction:true,contentBlockerEnabled:true,messagingEnabled:true,hasOnOpenWindowEvent:true,showsHorizontalScrollIndicator:true,showsVerticalScrollIndicator:true,newSource:true,userAgent:true,injectedJavaScriptObject:true},ConditionallyIgnoredEventHandlers({onContentSizeChange:true,onRenderProcessGone:true,onContentProcessDidTerminate:true,onCustomMenuSelection:true,onFileDownload:true,onLoadingError:true,onLoadingFinish:true,onLoadingProgress:true,onLoadingStart:true,onHttpError:true,onMessage:true,onOpenWindow:true,onScroll:true,onShouldStartLoadWithRequest:true}))};var _default=exports.default=NativeComponentRegistry.get(nativeComponentName,function(){return __INTERNAL_VIEW_CONFIG;});var Commands=exports.Commands={goBack:function goBack(ref){dispatchCommand(ref,"goBack",[]);},goForward:function goForward(ref){dispatchCommand(ref,"goForward",[]);},reload:function reload(ref){dispatchCommand(ref,"reload",[]);},stopLoading:function stopLoading(ref){dispatchCommand(ref,"stopLoading",[]);},injectJavaScript:function injectJavaScript(ref,javascript){dispatchCommand(ref,"injectJavaScript",[javascript]);},requestFocus:function requestFocus(ref){dispatchCommand(ref,"requestFocus",[]);},postMessage:function postMessage(ref,data){dispatchCommand(ref,"postMessage",[data]);},loadUrl:function loadUrl(ref,url){dispatchCommand(ref,"loadUrl",[url]);},clearFormData:function clearFormData(ref){dispatchCommand(ref,"clearFormData",[]);},clearCache:function clearCache(ref,includeDiskFiles){dispatchCommand(ref,"clearCache",[includeDiskFiles]);},clearHistory:function clearHistory(ref){dispatchCommand(ref,"clearHistory",[]);}};
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=exports.__INTERNAL_VIEW_CONFIG=exports.Commands=void 0;var _codegenNativeComponent=_interopRequireDefault(require("react-native/Libraries/Utilities/codegenNativeComponent"));var _codegenNativeCommands=_interopRequireDefault(require("react-native/Libraries/Utilities/codegenNativeCommands"));var NativeComponentRegistry=require('react-native/Libraries/NativeComponent/NativeComponentRegistry');var _require=require('react-native/Libraries/NativeComponent/ViewConfigIgnore'),ConditionallyIgnoredEventHandlers=_require.ConditionallyIgnoredEventHandlers;var _require2=require("react-native/Libraries/ReactNative/RendererProxy"),dispatchCommand=_require2.dispatchCommand;var nativeComponentName='RNCWebView';var __INTERNAL_VIEW_CONFIG=exports.__INTERNAL_VIEW_CONFIG={uiViewClassName:'RNCWebView',directEventTypes:{topContentSizeChange:{registrationName:'onContentSizeChange'},topRenderProcessGone:{registrationName:'onRenderProcessGone'},topContentProcessDidTerminate:{registrationName:'onContentProcessDidTerminate'},topCustomMenuSelection:{registrationName:'onCustomMenuSelection'},topFileDownload:{registrationName:'onFileDownload'},topLoadingError:{registrationName:'onLoadingError'},topLoadingSubResourceError:{registrationName:'onLoadingSubResourceError'},topLoadingFinish:{registrationName:'onLoadingFinish'},topLoadingProgress:{registrationName:'onLoadingProgress'},topLoadingStart:{registrationName:'onLoadingStart'},topHttpError:{registrationName:'onHttpError'},topMessage:{registrationName:'onMessage'},topOpenWindow:{registrationName:'onOpenWindow'},topScroll:{registrationName:'onScroll'},topShouldStartLoadWithRequest:{registrationName:'onShouldStartLoadWithRequest'}},validAttributes:Object.assign({allowFileAccess:true,allowsProtectedMedia:true,allowsFullscreenVideo:true,androidLayerType:true,cacheMode:true,domStorageEnabled:true,downloadingMessage:true,forceDarkOn:true,geolocationEnabled:true,lackPermissionToDownloadMessage:true,messagingModuleName:true,minimumFontSize:true,mixedContentMode:true,nestedScrollEnabled:true,overScrollMode:true,saveFormDataDisabled:true,scalesPageToFit:true,setBuiltInZoomControls:true,setDisplayZoomControls:true,setSupportMultipleWindows:true,textZoom:true,thirdPartyCookiesEnabled:true,hasOnScroll:true,allowingReadAccessToURL:true,allowsBackForwardNavigationGestures:true,allowsInlineMediaPlayback:true,allowsPictureInPictureMediaPlayback:true,allowsAirPlayForMediaPlayback:true,allowsLinkPreview:true,automaticallyAdjustContentInsets:true,autoManageStatusBarEnabled:true,bounces:true,contentInset:true,contentInsetAdjustmentBehavior:true,contentMode:true,dataDetectorTypes:true,decelerationRate:true,directionalLockEnabled:true,enableApplePay:true,hideKeyboardAccessoryView:true,keyboardDisplayRequiresUserAction:true,limitsNavigationsToAppBoundDomains:true,mediaCapturePermissionGrantType:true,pagingEnabled:true,pullToRefreshEnabled:true,refreshControlLightMode:true,scrollEnabled:true,sharedCookiesEnabled:true,textInteractionEnabled:true,useSharedProcessPool:true,menuItems:true,suppressMenuItems:true,hasOnFileDownload:true,fraudulentWebsiteWarningEnabled:true,allowFileAccessFromFileURLs:true,allowUniversalAccessFromFileURLs:true,applicationNameForUserAgent:true,basicAuthCredential:true,cacheEnabled:true,incognito:true,injectedJavaScript:true,injectedJavaScriptBeforeContentLoaded:true,injectedJavaScriptForMainFrameOnly:true,injectedJavaScriptBeforeContentLoadedForMainFrameOnly:true,javaScriptCanOpenWindowsAutomatically:true,javaScriptEnabled:true,webviewDebuggingEnabled:true,mediaPlaybackRequiresUserAction:true,contentBlockerEnabled:true,messagingEnabled:true,hasOnOpenWindowEvent:true,showsHorizontalScrollIndicator:true,showsVerticalScrollIndicator:true,indicatorStyle:true,newSource:true,userAgent:true,injectedJavaScriptObject:true,paymentRequestEnabled:true},ConditionallyIgnoredEventHandlers({onContentSizeChange:true,onRenderProcessGone:true,onContentProcessDidTerminate:true,onCustomMenuSelection:true,onFileDownload:true,onLoadingError:true,onLoadingSubResourceError:true,onLoadingFinish:true,onLoadingProgress:true,onLoadingStart:true,onHttpError:true,onMessage:true,onOpenWindow:true,onScroll:true,onShouldStartLoadWithRequest:true}))};var _default=exports.default=NativeComponentRegistry.get(nativeComponentName,function(){return __INTERNAL_VIEW_CONFIG;});var Commands=exports.Commands={goBack:function goBack(ref){dispatchCommand(ref,"goBack",[]);},goForward:function goForward(ref){dispatchCommand(ref,"goForward",[]);},reload:function reload(ref){dispatchCommand(ref,"reload",[]);},stopLoading:function stopLoading(ref){dispatchCommand(ref,"stopLoading",[]);},injectJavaScript:function injectJavaScript(ref,javascript){dispatchCommand(ref,"injectJavaScript",[javascript]);},requestFocus:function requestFocus(ref){dispatchCommand(ref,"requestFocus",[]);},postMessage:function postMessage(ref,data){dispatchCommand(ref,"postMessage",[data]);},loadUrl:function loadUrl(ref,url){dispatchCommand(ref,"loadUrl",[url]);},clearFormData:function clearFormData(ref){dispatchCommand(ref,"clearFormData",[]);},clearCache:function clearCache(ref,includeDiskFiles){dispatchCommand(ref,"clearCache",[includeDiskFiles]);},clearHistory:function clearHistory(ref){dispatchCommand(ref,"clearHistory",[]);}};
|