@exodus/react-native-webview 9.4.0-no-android.0 → 11.26.1-exodus.1
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/README.md +21 -18
- package/android/.editorconfig +6 -0
- package/android/build.gradle +137 -0
- package/android/gradle.properties +6 -0
- package/android/src/main/AndroidManifest.xml +15 -0
- package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewFileProvider.java +14 -0
- package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java +1650 -0
- package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewModule.java +550 -0
- package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewPackage.kt +15 -0
- package/android/src/main/java/com/reactnativecommunity/webview/WebViewConfig.java +12 -0
- package/android/src/main/java/com/reactnativecommunity/webview/events/TopHttpErrorEvent.kt +25 -0
- package/android/src/main/java/com/reactnativecommunity/webview/events/TopLoadingErrorEvent.kt +25 -0
- package/android/src/main/java/com/reactnativecommunity/webview/events/TopLoadingFinishEvent.kt +24 -0
- package/android/src/main/java/com/reactnativecommunity/webview/events/TopLoadingProgressEvent.kt +24 -0
- package/android/src/main/java/com/reactnativecommunity/webview/events/TopLoadingStartEvent.kt +25 -0
- package/android/src/main/java/com/reactnativecommunity/webview/events/TopMessageEvent.kt +24 -0
- package/android/src/main/java/com/reactnativecommunity/webview/events/TopRenderProcessGoneEvent.kt +26 -0
- package/android/src/main/java/com/reactnativecommunity/webview/events/TopShouldStartLoadWithRequestEvent.kt +29 -0
- package/android/src/main/res/xml/file_provider_paths.xml +6 -0
- package/apple/RNCWKProcessPoolManager.h +15 -0
- package/apple/RNCWKProcessPoolManager.m +36 -0
- package/apple/RNCWebView.h +117 -0
- package/apple/RNCWebView.m +1532 -0
- package/apple/RNCWebViewManager.h +13 -0
- package/apple/RNCWebViewManager.m +288 -0
- package/index.d.ts +65 -0
- package/index.js +4 -0
- package/ios/RNCWebView.xcodeproj/project.pbxproj +2 -0
- package/lib/WebView.android.d.ts +7 -0
- package/lib/WebView.android.js +125 -1
- package/lib/WebView.d.ts +7 -0
- package/lib/WebView.ios.d.ts +7 -0
- package/lib/WebView.ios.js +148 -202
- package/lib/WebView.js +9 -2
- package/lib/WebView.styles.d.ts +12 -0
- package/lib/WebView.styles.js +7 -7
- package/lib/WebViewNativeComponent.android.d.ts +4 -0
- package/lib/WebViewNativeComponent.android.js +3 -0
- package/lib/WebViewNativeComponent.ios.d.ts +4 -0
- package/lib/WebViewNativeComponent.ios.js +3 -0
- package/lib/WebViewShared.d.ts +37 -0
- package/lib/WebViewShared.js +121 -24
- package/lib/WebViewTypes.d.ts +873 -0
- package/lib/WebViewTypes.js +31 -16
- package/lib/index.d.ts +4 -0
- package/lib/index.js +3 -0
- package/package.json +83 -87
- package/react-native-webview.podspec +4 -4
- package/react-native.config.js +37 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
package com.reactnativecommunity.webview.events
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.WritableMap
|
|
4
|
+
import com.facebook.react.uimanager.events.Event
|
|
5
|
+
import com.facebook.react.uimanager.events.RCTEventEmitter
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Event emitted when loading has started
|
|
9
|
+
*/
|
|
10
|
+
class TopLoadingStartEvent(viewId: Int, private val mEventData: WritableMap) :
|
|
11
|
+
Event<TopLoadingStartEvent>(viewId) {
|
|
12
|
+
companion object {
|
|
13
|
+
const val EVENT_NAME = "topLoadingStart"
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
override fun getEventName(): String = EVENT_NAME
|
|
17
|
+
|
|
18
|
+
override fun canCoalesce(): Boolean = false
|
|
19
|
+
|
|
20
|
+
override fun getCoalescingKey(): Short = 0
|
|
21
|
+
|
|
22
|
+
override fun dispatch(rctEventEmitter: RCTEventEmitter) =
|
|
23
|
+
rctEventEmitter.receiveEvent(viewTag, eventName, mEventData)
|
|
24
|
+
|
|
25
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
package com.reactnativecommunity.webview.events
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.WritableMap
|
|
4
|
+
import com.facebook.react.uimanager.events.Event
|
|
5
|
+
import com.facebook.react.uimanager.events.RCTEventEmitter
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Event emitted when there is an error in loading.
|
|
9
|
+
*/
|
|
10
|
+
class TopMessageEvent(viewId: Int, private val mEventData: WritableMap) : Event<TopMessageEvent>(viewId) {
|
|
11
|
+
companion object {
|
|
12
|
+
const val EVENT_NAME = "topMessage"
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
override fun getEventName(): String = EVENT_NAME
|
|
16
|
+
|
|
17
|
+
override fun canCoalesce(): Boolean = false
|
|
18
|
+
|
|
19
|
+
override fun getCoalescingKey(): Short = 0
|
|
20
|
+
|
|
21
|
+
override fun dispatch(rctEventEmitter: RCTEventEmitter) {
|
|
22
|
+
rctEventEmitter.receiveEvent(viewTag, EVENT_NAME, mEventData)
|
|
23
|
+
}
|
|
24
|
+
}
|
package/android/src/main/java/com/reactnativecommunity/webview/events/TopRenderProcessGoneEvent.kt
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
package com.reactnativecommunity.webview.events
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.WritableMap
|
|
4
|
+
import com.facebook.react.uimanager.events.Event
|
|
5
|
+
import com.facebook.react.uimanager.events.RCTEventEmitter
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Event emitted when the WebView's process has crashed or
|
|
9
|
+
was killed by the OS.
|
|
10
|
+
*/
|
|
11
|
+
class TopRenderProcessGoneEvent(viewId: Int, private val mEventData: WritableMap) :
|
|
12
|
+
Event<TopRenderProcessGoneEvent>(viewId) {
|
|
13
|
+
companion object {
|
|
14
|
+
const val EVENT_NAME = "topRenderProcessGone"
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
override fun getEventName(): String = EVENT_NAME
|
|
18
|
+
|
|
19
|
+
override fun canCoalesce(): Boolean = false
|
|
20
|
+
|
|
21
|
+
override fun getCoalescingKey(): Short = 0
|
|
22
|
+
|
|
23
|
+
override fun dispatch(rctEventEmitter: RCTEventEmitter) =
|
|
24
|
+
rctEventEmitter.receiveEvent(viewTag, eventName, mEventData)
|
|
25
|
+
|
|
26
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
package com.reactnativecommunity.webview.events
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.WritableMap
|
|
4
|
+
import com.facebook.react.uimanager.events.Event
|
|
5
|
+
import com.facebook.react.uimanager.events.RCTEventEmitter
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Event emitted when shouldOverrideUrlLoading is called
|
|
9
|
+
*/
|
|
10
|
+
class TopShouldStartLoadWithRequestEvent(viewId: Int, private val mData: WritableMap) : Event<TopShouldStartLoadWithRequestEvent>(viewId) {
|
|
11
|
+
companion object {
|
|
12
|
+
const val EVENT_NAME = "topShouldStartLoadWithRequest"
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
init {
|
|
16
|
+
mData.putString("navigationType", "other")
|
|
17
|
+
// Android does not raise shouldOverrideUrlLoading for inner frames
|
|
18
|
+
mData.putBoolean("isTopFrame", true)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
override fun getEventName(): String = EVENT_NAME
|
|
22
|
+
|
|
23
|
+
override fun canCoalesce(): Boolean = false
|
|
24
|
+
|
|
25
|
+
override fun getCoalescingKey(): Short = 0
|
|
26
|
+
|
|
27
|
+
override fun dispatch(rctEventEmitter: RCTEventEmitter) =
|
|
28
|
+
rctEventEmitter.receiveEvent(viewTag, EVENT_NAME, mData)
|
|
29
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2015-present, Facebook, Inc.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#import <WebKit/WebKit.h>
|
|
9
|
+
|
|
10
|
+
@interface RNCWKProcessPoolManager : NSObject
|
|
11
|
+
|
|
12
|
+
+ (instancetype) sharedManager;
|
|
13
|
+
- (WKProcessPool *)sharedProcessPool;
|
|
14
|
+
|
|
15
|
+
@end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2015-present, Facebook, Inc.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#import <Foundation/Foundation.h>
|
|
9
|
+
#import "RNCWKProcessPoolManager.h"
|
|
10
|
+
|
|
11
|
+
@interface RNCWKProcessPoolManager() {
|
|
12
|
+
WKProcessPool *_sharedProcessPool;
|
|
13
|
+
}
|
|
14
|
+
@end
|
|
15
|
+
|
|
16
|
+
@implementation RNCWKProcessPoolManager
|
|
17
|
+
|
|
18
|
+
+ (id) sharedManager {
|
|
19
|
+
static RNCWKProcessPoolManager *_sharedManager = nil;
|
|
20
|
+
@synchronized(self) {
|
|
21
|
+
if(_sharedManager == nil) {
|
|
22
|
+
_sharedManager = [[super alloc] init];
|
|
23
|
+
}
|
|
24
|
+
return _sharedManager;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
- (WKProcessPool *)sharedProcessPool {
|
|
29
|
+
if (!_sharedProcessPool) {
|
|
30
|
+
_sharedProcessPool = [[WKProcessPool alloc] init];
|
|
31
|
+
}
|
|
32
|
+
return _sharedProcessPool;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@end
|
|
36
|
+
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2015-present, Facebook, Inc.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#import <React/RCTView.h>
|
|
9
|
+
#import <React/RCTDefines.h>
|
|
10
|
+
#import <WebKit/WebKit.h>
|
|
11
|
+
|
|
12
|
+
typedef enum RNCWebViewPermissionGrantType : NSUInteger {
|
|
13
|
+
RNCWebViewPermissionGrantType_GrantIfSameHost_ElsePrompt,
|
|
14
|
+
RNCWebViewPermissionGrantType_GrantIfSameHost_ElseDeny,
|
|
15
|
+
RNCWebViewPermissionGrantType_Deny,
|
|
16
|
+
RNCWebViewPermissionGrantType_Grant,
|
|
17
|
+
RNCWebViewPermissionGrantType_Prompt
|
|
18
|
+
} RNCWebViewPermissionGrantType;
|
|
19
|
+
|
|
20
|
+
@class RNCWebView;
|
|
21
|
+
|
|
22
|
+
@protocol RNCWebViewDelegate <NSObject>
|
|
23
|
+
|
|
24
|
+
- (BOOL)webView:(RNCWebView *_Nonnull)webView
|
|
25
|
+
shouldStartLoadForRequest:(NSMutableDictionary<NSString *, id> *_Nonnull)request
|
|
26
|
+
withCallback:(RCTDirectEventBlock _Nonnull)callback;
|
|
27
|
+
|
|
28
|
+
@end
|
|
29
|
+
|
|
30
|
+
@interface RNCWeakScriptMessageDelegate : NSObject<WKScriptMessageHandler>
|
|
31
|
+
|
|
32
|
+
@property (nonatomic, weak, nullable) id<WKScriptMessageHandler> scriptDelegate;
|
|
33
|
+
|
|
34
|
+
- (nullable instancetype)initWithDelegate:(id<WKScriptMessageHandler> _Nullable)scriptDelegate;
|
|
35
|
+
|
|
36
|
+
@end
|
|
37
|
+
|
|
38
|
+
@interface RNCWebView : RCTView
|
|
39
|
+
|
|
40
|
+
@property (nonatomic, weak) id<RNCWebViewDelegate> _Nullable delegate;
|
|
41
|
+
@property (nonatomic, copy) NSDictionary * _Nullable source;
|
|
42
|
+
@property (nonatomic, assign) BOOL messagingEnabled;
|
|
43
|
+
@property (nonatomic, copy) NSString * _Nullable injectedJavaScript;
|
|
44
|
+
@property (nonatomic, copy) NSString * _Nullable injectedJavaScriptBeforeContentLoaded;
|
|
45
|
+
@property (nonatomic, assign) BOOL injectedJavaScriptForMainFrameOnly;
|
|
46
|
+
@property (nonatomic, assign) BOOL injectedJavaScriptBeforeContentLoadedForMainFrameOnly;
|
|
47
|
+
@property (nonatomic, assign) BOOL scrollEnabled;
|
|
48
|
+
@property (nonatomic, assign) BOOL sharedCookiesEnabled;
|
|
49
|
+
@property (nonatomic, assign) BOOL autoManageStatusBarEnabled;
|
|
50
|
+
@property (nonatomic, assign) BOOL pagingEnabled;
|
|
51
|
+
@property (nonatomic, assign) CGFloat decelerationRate;
|
|
52
|
+
@property (nonatomic, assign) BOOL allowsInlineMediaPlayback;
|
|
53
|
+
@property (nonatomic, assign) BOOL allowsAirPlayForMediaPlayback;
|
|
54
|
+
@property (nonatomic, assign) BOOL bounces;
|
|
55
|
+
@property (nonatomic, assign) BOOL mediaPlaybackRequiresUserAction;
|
|
56
|
+
#if WEBKIT_IOS_10_APIS_AVAILABLE
|
|
57
|
+
@property (nonatomic, assign) WKDataDetectorTypes dataDetectorTypes;
|
|
58
|
+
#endif
|
|
59
|
+
@property (nonatomic, assign) UIEdgeInsets contentInset;
|
|
60
|
+
@property (nonatomic, assign) BOOL automaticallyAdjustContentInsets;
|
|
61
|
+
@property (nonatomic, assign) BOOL keyboardDisplayRequiresUserAction;
|
|
62
|
+
@property (nonatomic, assign) BOOL hideKeyboardAccessoryView;
|
|
63
|
+
@property (nonatomic, assign) BOOL allowsBackForwardNavigationGestures;
|
|
64
|
+
@property (nonatomic, assign) BOOL incognito;
|
|
65
|
+
@property (nonatomic, assign) BOOL useSharedProcessPool;
|
|
66
|
+
@property (nonatomic, copy) NSString * _Nullable userAgent;
|
|
67
|
+
@property (nonatomic, copy) NSString * _Nullable applicationNameForUserAgent;
|
|
68
|
+
@property (nonatomic, assign) BOOL cacheEnabled;
|
|
69
|
+
@property (nonatomic, assign) BOOL javaScriptEnabled;
|
|
70
|
+
@property (nonatomic, assign) BOOL allowFileAccessFromFileURLs;
|
|
71
|
+
@property (nonatomic, assign) BOOL allowUniversalAccessFromFileURLs;
|
|
72
|
+
@property (nonatomic, assign) BOOL allowsLinkPreview;
|
|
73
|
+
@property (nonatomic, assign) BOOL showsHorizontalScrollIndicator;
|
|
74
|
+
@property (nonatomic, assign) BOOL showsVerticalScrollIndicator;
|
|
75
|
+
@property (nonatomic, assign) BOOL directionalLockEnabled;
|
|
76
|
+
@property (nonatomic, assign) BOOL ignoreSilentHardwareSwitch;
|
|
77
|
+
@property (nonatomic, copy) NSString * _Nullable allowingReadAccessToURL;
|
|
78
|
+
@property (nonatomic, copy) NSDictionary * _Nullable basicAuthCredential;
|
|
79
|
+
@property (nonatomic, assign) BOOL pullToRefreshEnabled;
|
|
80
|
+
@property (nonatomic, assign) BOOL enableApplePay;
|
|
81
|
+
@property (nonatomic, copy) NSArray<NSDictionary *> * _Nullable menuItems;
|
|
82
|
+
@property (nonatomic, copy) RCTDirectEventBlock onCustomMenuSelection;
|
|
83
|
+
#if !TARGET_OS_OSX
|
|
84
|
+
@property (nonatomic, weak) UIRefreshControl * _Nullable refreshControl;
|
|
85
|
+
#endif
|
|
86
|
+
|
|
87
|
+
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* iOS 13 */
|
|
88
|
+
@property (nonatomic, assign) WKContentMode contentMode;
|
|
89
|
+
#endif
|
|
90
|
+
|
|
91
|
+
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 /* iOS 14 */
|
|
92
|
+
@property (nonatomic, assign) BOOL limitsNavigationsToAppBoundDomains;
|
|
93
|
+
#endif
|
|
94
|
+
|
|
95
|
+
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 140500 /* iOS 14.5 */
|
|
96
|
+
@property (nonatomic, assign) BOOL textInteractionEnabled;
|
|
97
|
+
#endif
|
|
98
|
+
|
|
99
|
+
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 150000 /* iOS 15 */
|
|
100
|
+
@property (nonatomic, assign) RNCWebViewPermissionGrantType mediaCapturePermissionGrantType;
|
|
101
|
+
#endif
|
|
102
|
+
|
|
103
|
+
+ (void)setClientAuthenticationCredential:(nullable NSURLCredential*)credential;
|
|
104
|
+
+ (void)setCustomCertificatesForHost:(nullable NSDictionary *)certificates;
|
|
105
|
+
- (void)postMessage:(NSString *_Nullable)message;
|
|
106
|
+
- (void)injectJavaScript:(NSString *_Nullable)script;
|
|
107
|
+
- (void)goForward;
|
|
108
|
+
- (void)goBack;
|
|
109
|
+
- (void)reload;
|
|
110
|
+
- (void)stopLoading;
|
|
111
|
+
- (void)requestFocus;
|
|
112
|
+
#if !TARGET_OS_OSX
|
|
113
|
+
- (void)addPullToRefreshControl;
|
|
114
|
+
- (void)pullToRefresh:(UIRefreshControl *_Nonnull)refreshControl;
|
|
115
|
+
#endif
|
|
116
|
+
|
|
117
|
+
@end
|