@react-native-ohos/react-native-webview 13.10.5-rc.5 → 13.10.5-rc.6

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.
@@ -6,7 +6,7 @@
6
6
  "name": "@react-native-ohos/react-native-webview",
7
7
  "description": "main cpai architecture",
8
8
  "main": "index.ets",
9
- "version": "13.10.5-rc.5",
9
+ "version": "13.10.5-rc.6",
10
10
  "dependencies": {
11
11
  "@rnoh/react-native-openharmony": "0.72.59"
12
12
  }
@@ -31,6 +31,8 @@ namespace rnoh {
31
31
  object.setProperty(rt, "injectedJavaScriptBeforeContentLoadedForMainFrameOnly", true);
32
32
  object.setProperty(rt, "javaScriptCanOpenWindowsAutomatically", true);
33
33
  object.setProperty(rt, "javaScriptEnabled", true);
34
+ object.setProperty(rt, "hasOnShouldStartLoadWithRequestEvent", true);
35
+ object.setProperty(rt, "originWhitelist", true);
34
36
  object.setProperty(rt, "webviewDebuggingEnabled", true);
35
37
  object.setProperty(rt, "mediaPlaybackRequiresUserAction", true);
36
38
  object.setProperty(rt, "messagingEnabled", true);
@@ -16,136 +16,140 @@
16
16
  namespace facebook {
17
17
  namespace react {
18
18
 
19
- RNCWebViewProps::RNCWebViewProps(
20
- const PropsParserContext &context,
21
- const RNCWebViewProps &sourceProps,
22
- const RawProps &rawProps): ViewProps(context, sourceProps, rawProps),
19
+ RNCWebViewProps::RNCWebViewProps(const PropsParserContext &context, const RNCWebViewProps &sourceProps,
20
+ const RawProps &rawProps)
21
+ : ViewProps(context, sourceProps, rawProps),
23
22
 
24
- allowFileAccess(convertRawProp(context, rawProps, "allowFileAccess", sourceProps.allowFileAccess, {false})),
25
- allowsProtectedMedia(convertRawProp(context, rawProps, "allowsProtectedMedia",
26
- sourceProps.allowsProtectedMedia, {false})),
27
- allowsFullscreenVideo(convertRawProp(context, rawProps, "allowsFullscreenVideo",
28
- sourceProps.allowsFullscreenVideo, {false})),
29
- androidLayerType(convertRawProp(context, rawProps, "androidLayerType",
30
- sourceProps.androidLayerType, {RNCWebViewAndroidLayerType::None})),
31
- cacheMode(convertRawProp(context, rawProps, "cacheMode", sourceProps.cacheMode,
32
- {RNCWebViewCacheMode::LOAD_DEFAULT})),
33
- domStorageEnabled(convertRawProp(context, rawProps, "domStorageEnabled", sourceProps.domStorageEnabled, {false})),
34
- downloadingMessage(convertRawProp(context, rawProps, "downloadingMessage", sourceProps.downloadingMessage, {})),
35
- forceDarkOn(convertRawProp(context, rawProps, "forceDarkOn", sourceProps.forceDarkOn, {false})),
36
- geolocationEnabled(convertRawProp(context, rawProps, "geolocationEnabled",
37
- sourceProps.geolocationEnabled, {false})),
38
- lackPermissionToDownloadMessage(convertRawProp(context, rawProps, "lackPermissionToDownloadMessage",
39
- sourceProps.lackPermissionToDownloadMessage, {})),
40
- messagingModuleName(convertRawProp(context, rawProps, "messagingModuleName", sourceProps.messagingModuleName, {})),
41
- minimumFontSize(convertRawProp(context, rawProps, "minimumFontSize", sourceProps.minimumFontSize, {0})),
42
- mixedContentMode(convertRawProp(context, rawProps, "mixedContentMode", sourceProps.mixedContentMode,
43
- {RNCWebViewMixedContentMode::Never})),
44
- nestedScrollEnabled(convertRawProp(context, rawProps, "nestedScrollEnabled",
45
- sourceProps.nestedScrollEnabled, {false})),
46
- overScrollMode(convertRawProp(context, rawProps, "overScrollMode", sourceProps.overScrollMode, {})),
47
- saveFormDataDisabled(convertRawProp(context, rawProps, "saveFormDataDisabled",
48
- sourceProps.saveFormDataDisabled, {false})),
49
- scalesPageToFit(convertRawProp(context, rawProps, "scalesPageToFit", sourceProps.scalesPageToFit, {false})),
50
- setBuiltInZoomControls(convertRawProp(context, rawProps, "setBuiltInZoomControls",
51
- sourceProps.setBuiltInZoomControls, {false})),
52
- setDisplayZoomControls(convertRawProp(context, rawProps, "setDisplayZoomControls",
53
- sourceProps.setDisplayZoomControls, {false})),
54
- setSupportMultipleWindows(convertRawProp(context, rawProps, "setSupportMultipleWindows",
55
- sourceProps.setSupportMultipleWindows, {false})),
56
- textZoom(convertRawProp(context, rawProps, "textZoom", sourceProps.textZoom, {0})),
57
- thirdPartyCookiesEnabled(convertRawProp(context, rawProps, "thirdPartyCookiesEnabled",
58
- sourceProps.thirdPartyCookiesEnabled, {false})),
59
- hasOnScroll(convertRawProp(context, rawProps, "hasOnScroll", sourceProps.hasOnScroll, {false})),
60
- injectedJavaScriptObject(convertRawProp(context, rawProps, "injectedJavaScriptObject",
61
- sourceProps.injectedJavaScriptObject, {})),
62
- allowingReadAccessToURL(convertRawProp(context, rawProps, "allowingReadAccessToURL",
63
- sourceProps.allowingReadAccessToURL, {})),
64
- allowsBackForwardNavigationGestures(convertRawProp(context, rawProps, "allowsBackForwardNavigationGestures",
65
- sourceProps.allowsBackForwardNavigationGestures, {false})),
66
- allowsInlineMediaPlayback(convertRawProp(context, rawProps, "allowsInlineMediaPlayback",
67
- sourceProps.allowsInlineMediaPlayback, {false})),
68
- allowsAirPlayForMediaPlayback(convertRawProp(context, rawProps, "allowsAirPlayForMediaPlayback",
69
- sourceProps.allowsAirPlayForMediaPlayback, {false})),
70
- allowsLinkPreview(convertRawProp(context, rawProps, "allowsLinkPreview",
71
- sourceProps.allowsLinkPreview, {false})),
72
- automaticallyAdjustContentInsets(convertRawProp(context, rawProps, "automaticallyAdjustContentInsets",
73
- sourceProps.automaticallyAdjustContentInsets, {false})),
74
- ignoreSilentHardwareSwitch(convertRawProp(context, rawProps, "ignoreSilentHardwareSwitch",
75
- sourceProps.ignoreSilentHardwareSwitch, {false})),
76
- autoManageStatusBarEnabled(convertRawProp(context, rawProps, "autoManageStatusBarEnabled",
77
- sourceProps.autoManageStatusBarEnabled, {false})),
78
- bounces(convertRawProp(context, rawProps, "bounces", sourceProps.bounces, {false})),
79
- contentInset(convertRawProp(context, rawProps, "contentInset", sourceProps.contentInset, {})),
80
- contentInsetAdjustmentBehavior(convertRawProp(context, rawProps, "contentInsetAdjustmentBehavior",
81
- sourceProps.contentInsetAdjustmentBehavior, {RNCWebViewContentInsetAdjustmentBehavior::Never})),
82
- contentMode(convertRawProp(context, rawProps, "contentMode", sourceProps.contentMode,
83
- {RNCWebViewContentMode::Recommended})),
84
- dataDetectorTypes(convertRawProp(context, rawProps, "dataDetectorTypes", sourceProps.dataDetectorTypes, {})),
85
- decelerationRate(convertRawProp(context, rawProps, "decelerationRate", sourceProps.decelerationRate, {0.0})),
86
- directionalLockEnabled(convertRawProp(context, rawProps, "directionalLockEnabled",
87
- sourceProps.directionalLockEnabled, {false})),
88
- enableApplePay(convertRawProp(context, rawProps, "enableApplePay", sourceProps.enableApplePay, {false})),
89
- hideKeyboardAccessoryView(convertRawProp(context, rawProps, "hideKeyboardAccessoryView",
90
- sourceProps.hideKeyboardAccessoryView, {false})),
91
- keyboardDisplayRequiresUserAction(convertRawProp(context, rawProps, "keyboardDisplayRequiresUserAction",
92
- sourceProps.keyboardDisplayRequiresUserAction, {false})),
93
- limitsNavigationsToAppBoundDomains(convertRawProp(context, rawProps, "limitsNavigationsToAppBoundDomains",
94
- sourceProps.limitsNavigationsToAppBoundDomains, {false})),
95
- mediaCapturePermissionGrantType(convertRawProp(context, rawProps, "mediaCapturePermissionGrantType",
96
- sourceProps.mediaCapturePermissionGrantType, {RNCWebViewMediaCapturePermissionGrantType::Prompt})),
97
- pagingEnabled(convertRawProp(context, rawProps, "pagingEnabled", sourceProps.pagingEnabled, {false})),
98
- pullToRefreshEnabled(convertRawProp(context, rawProps, "pullToRefreshEnabled",
99
- sourceProps.pullToRefreshEnabled, {false})),
100
- scrollEnabled(convertRawProp(context, rawProps, "scrollEnabled", sourceProps.scrollEnabled, {false})),
101
- sharedCookiesEnabled(convertRawProp(context, rawProps, "sharedCookiesEnabled",
102
- sourceProps.sharedCookiesEnabled, {false})),
103
- textInteractionEnabled(convertRawProp(context, rawProps, "textInteractionEnabled",
104
- sourceProps.textInteractionEnabled, {false})),
105
- useSharedProcessPool(convertRawProp(context, rawProps, "useSharedProcessPool",
106
- sourceProps.useSharedProcessPool, {false})),
107
- menuItems(convertRawProp(context, rawProps, "menuItems", sourceProps.menuItems, {})),
108
- suppressMenuItems(convertRawProp(context, rawProps, "suppressMenuItems", sourceProps.suppressMenuItems, {})),
109
- hasOnFileDownload(convertRawProp(context, rawProps, "hasOnFileDownload", sourceProps.hasOnFileDownload, {false})),
110
- fraudulentWebsiteWarningEnabled(convertRawProp(context, rawProps, "fraudulentWebsiteWarningEnabled",
111
- sourceProps.fraudulentWebsiteWarningEnabled, {false})),
112
- allowFileAccessFromFileURLs(convertRawProp(context, rawProps, "allowFileAccessFromFileURLs",
113
- sourceProps.allowFileAccessFromFileURLs, {false})),
114
- allowUniversalAccessFromFileURLs(convertRawProp(context, rawProps, "allowUniversalAccessFromFileURLs",
115
- sourceProps.allowUniversalAccessFromFileURLs, {false})),
116
- applicationNameForUserAgent(convertRawProp(context, rawProps, "applicationNameForUserAgent",
117
- sourceProps.applicationNameForUserAgent, {})),
118
- basicAuthCredential(convertRawProp(context, rawProps, "basicAuthCredential", sourceProps.basicAuthCredential, {})),
119
- cacheEnabled(convertRawProp(context, rawProps, "cacheEnabled", sourceProps.cacheEnabled, {false})),
120
- incognito(convertRawProp(context, rawProps, "incognito", sourceProps.incognito, {false})),
121
- injectedJavaScript(convertRawProp(context, rawProps, "injectedJavaScript", sourceProps.injectedJavaScript, {})),
122
- injectedJavaScriptBeforeContentLoaded(convertRawProp(context, rawProps, "injectedJavaScriptBeforeContentLoaded",
123
- sourceProps.injectedJavaScriptBeforeContentLoaded, {})),
124
- injectedJavaScriptForMainFrameOnly(convertRawProp(context, rawProps, "injectedJavaScriptForMainFrameOnly",
125
- sourceProps.injectedJavaScriptForMainFrameOnly, {false})),
126
- injectedJavaScriptBeforeContentLoadedForMainFrameOnly(convertRawProp(context, rawProps,
127
- "injectedJavaScriptBeforeContentLoadedForMainFrameOnly",
128
- sourceProps.injectedJavaScriptBeforeContentLoadedForMainFrameOnly, {false})),
129
- javaScriptCanOpenWindowsAutomatically(convertRawProp(context, rawProps, "javaScriptCanOpenWindowsAutomatically",
130
- sourceProps.javaScriptCanOpenWindowsAutomatically, {false})),
131
- javaScriptEnabled(convertRawProp(context, rawProps, "javaScriptEnabled", sourceProps.javaScriptEnabled, {false})),
132
- webviewDebuggingEnabled(convertRawProp(context, rawProps, "webviewDebuggingEnabled",
133
- sourceProps.webviewDebuggingEnabled, {false})),
134
- mediaPlaybackRequiresUserAction(convertRawProp(context, rawProps, "mediaPlaybackRequiresUserAction",
135
- sourceProps.mediaPlaybackRequiresUserAction, {false})),
136
- messagingEnabled(convertRawProp(context, rawProps, "messagingEnabled", sourceProps.messagingEnabled, {false})),
137
- shouldStartLoadWithRequestEnabled(convertRawProp(context, rawProps, "shouldStartLoadWithRequestEnabled",
138
- sourceProps.shouldStartLoadWithRequestEnabled, {false})),
139
- hasOnOpenWindowEvent(convertRawProp(context, rawProps, "hasOnOpenWindowEvent",
140
- sourceProps.hasOnOpenWindowEvent, {false})),
141
- showsHorizontalScrollIndicator(convertRawProp(context, rawProps, "showsHorizontalScrollIndicator",
142
- sourceProps.showsHorizontalScrollIndicator, {false})),
143
- showsVerticalScrollIndicator(convertRawProp(context, rawProps, "showsVerticalScrollIndicator",
144
- sourceProps.showsVerticalScrollIndicator, {false})),
145
- newSource(convertRawProp(context, rawProps, "newSource", sourceProps.newSource, {})),
146
- userAgent(convertRawProp(context, rawProps, "userAgent", sourceProps.userAgent, {})),
147
- schemeList(convertRawProp(context, rawProps, "schemeList", sourceProps.schemeList, {}))
148
- {}
23
+ allowFileAccess(convertRawProp(context, rawProps, "allowFileAccess", sourceProps.allowFileAccess, {false})),
24
+ allowsProtectedMedia(
25
+ convertRawProp(context, rawProps, "allowsProtectedMedia", sourceProps.allowsProtectedMedia, {false})),
26
+ allowsFullscreenVideo(
27
+ convertRawProp(context, rawProps, "allowsFullscreenVideo", sourceProps.allowsFullscreenVideo, {false})),
28
+ androidLayerType(convertRawProp(context, rawProps, "androidLayerType", sourceProps.androidLayerType,
29
+ {RNCWebViewAndroidLayerType::None})),
30
+ cacheMode(
31
+ convertRawProp(context, rawProps, "cacheMode", sourceProps.cacheMode, {RNCWebViewCacheMode::LOAD_DEFAULT})),
32
+ domStorageEnabled(convertRawProp(context, rawProps, "domStorageEnabled", sourceProps.domStorageEnabled, {false})),
33
+ downloadingMessage(convertRawProp(context, rawProps, "downloadingMessage", sourceProps.downloadingMessage, {})),
34
+ forceDarkOn(convertRawProp(context, rawProps, "forceDarkOn", sourceProps.forceDarkOn, {false})),
35
+ geolocationEnabled(
36
+ convertRawProp(context, rawProps, "geolocationEnabled", sourceProps.geolocationEnabled, {false})),
37
+ lackPermissionToDownloadMessage(convertRawProp(context, rawProps, "lackPermissionToDownloadMessage",
38
+ sourceProps.lackPermissionToDownloadMessage, {})),
39
+ messagingModuleName(
40
+ convertRawProp(context, rawProps, "messagingModuleName", sourceProps.messagingModuleName, {})),
41
+ minimumFontSize(convertRawProp(context, rawProps, "minimumFontSize", sourceProps.minimumFontSize, {0})),
42
+ mixedContentMode(convertRawProp(context, rawProps, "mixedContentMode", sourceProps.mixedContentMode,
43
+ {RNCWebViewMixedContentMode::Never})),
44
+ nestedScrollEnabled(
45
+ convertRawProp(context, rawProps, "nestedScrollEnabled", sourceProps.nestedScrollEnabled, {false})),
46
+ overScrollMode(convertRawProp(context, rawProps, "overScrollMode", sourceProps.overScrollMode, {})),
47
+ saveFormDataDisabled(
48
+ convertRawProp(context, rawProps, "saveFormDataDisabled", sourceProps.saveFormDataDisabled, {false})),
49
+ scalesPageToFit(convertRawProp(context, rawProps, "scalesPageToFit", sourceProps.scalesPageToFit, {false})),
50
+ setBuiltInZoomControls(
51
+ convertRawProp(context, rawProps, "setBuiltInZoomControls", sourceProps.setBuiltInZoomControls, {false})),
52
+ setDisplayZoomControls(
53
+ convertRawProp(context, rawProps, "setDisplayZoomControls", sourceProps.setDisplayZoomControls, {false})),
54
+ setSupportMultipleWindows(convertRawProp(context, rawProps, "setSupportMultipleWindows",
55
+ sourceProps.setSupportMultipleWindows, {false})),
56
+ textZoom(convertRawProp(context, rawProps, "textZoom", sourceProps.textZoom, {0})),
57
+ thirdPartyCookiesEnabled(
58
+ convertRawProp(context, rawProps, "thirdPartyCookiesEnabled", sourceProps.thirdPartyCookiesEnabled, {false})),
59
+ hasOnScroll(convertRawProp(context, rawProps, "hasOnScroll", sourceProps.hasOnScroll, {false})),
60
+ injectedJavaScriptObject(
61
+ convertRawProp(context, rawProps, "injectedJavaScriptObject", sourceProps.injectedJavaScriptObject, {})),
62
+ allowingReadAccessToURL(
63
+ convertRawProp(context, rawProps, "allowingReadAccessToURL", sourceProps.allowingReadAccessToURL, {})),
64
+ allowsBackForwardNavigationGestures(convertRawProp(context, rawProps, "allowsBackForwardNavigationGestures",
65
+ sourceProps.allowsBackForwardNavigationGestures, {false})),
66
+ allowsInlineMediaPlayback(convertRawProp(context, rawProps, "allowsInlineMediaPlayback",
67
+ sourceProps.allowsInlineMediaPlayback, {false})),
68
+ allowsAirPlayForMediaPlayback(convertRawProp(context, rawProps, "allowsAirPlayForMediaPlayback",
69
+ sourceProps.allowsAirPlayForMediaPlayback, {false})),
70
+ allowsLinkPreview(convertRawProp(context, rawProps, "allowsLinkPreview", sourceProps.allowsLinkPreview, {false})),
71
+ automaticallyAdjustContentInsets(convertRawProp(context, rawProps, "automaticallyAdjustContentInsets",
72
+ sourceProps.automaticallyAdjustContentInsets, {false})),
73
+ ignoreSilentHardwareSwitch(convertRawProp(context, rawProps, "ignoreSilentHardwareSwitch",
74
+ sourceProps.ignoreSilentHardwareSwitch, {false})),
75
+ autoManageStatusBarEnabled(convertRawProp(context, rawProps, "autoManageStatusBarEnabled",
76
+ sourceProps.autoManageStatusBarEnabled, {false})),
77
+ bounces(convertRawProp(context, rawProps, "bounces", sourceProps.bounces, {false})),
78
+ contentInset(convertRawProp(context, rawProps, "contentInset", sourceProps.contentInset, {})),
79
+ contentInsetAdjustmentBehavior(convertRawProp(context, rawProps, "contentInsetAdjustmentBehavior",
80
+ sourceProps.contentInsetAdjustmentBehavior,
81
+ {RNCWebViewContentInsetAdjustmentBehavior::Never})),
82
+ contentMode(convertRawProp(context, rawProps, "contentMode", sourceProps.contentMode,
83
+ {RNCWebViewContentMode::Recommended})),
84
+ dataDetectorTypes(convertRawProp(context, rawProps, "dataDetectorTypes", sourceProps.dataDetectorTypes, {})),
85
+ decelerationRate(convertRawProp(context, rawProps, "decelerationRate", sourceProps.decelerationRate, {0.0})),
86
+ directionalLockEnabled(
87
+ convertRawProp(context, rawProps, "directionalLockEnabled", sourceProps.directionalLockEnabled, {false})),
88
+ enableApplePay(convertRawProp(context, rawProps, "enableApplePay", sourceProps.enableApplePay, {false})),
89
+ hideKeyboardAccessoryView(convertRawProp(context, rawProps, "hideKeyboardAccessoryView",
90
+ sourceProps.hideKeyboardAccessoryView, {false})),
91
+ keyboardDisplayRequiresUserAction(convertRawProp(context, rawProps, "keyboardDisplayRequiresUserAction",
92
+ sourceProps.keyboardDisplayRequiresUserAction, {false})),
93
+ limitsNavigationsToAppBoundDomains(convertRawProp(context, rawProps, "limitsNavigationsToAppBoundDomains",
94
+ sourceProps.limitsNavigationsToAppBoundDomains, {false})),
95
+ mediaCapturePermissionGrantType(convertRawProp(context, rawProps, "mediaCapturePermissionGrantType",
96
+ sourceProps.mediaCapturePermissionGrantType,
97
+ {RNCWebViewMediaCapturePermissionGrantType::Prompt})),
98
+ pagingEnabled(convertRawProp(context, rawProps, "pagingEnabled", sourceProps.pagingEnabled, {false})),
99
+ pullToRefreshEnabled(
100
+ convertRawProp(context, rawProps, "pullToRefreshEnabled", sourceProps.pullToRefreshEnabled, {false})),
101
+ scrollEnabled(convertRawProp(context, rawProps, "scrollEnabled", sourceProps.scrollEnabled, {false})),
102
+ hasOnShouldStartLoadWithRequestEvent(convertRawProp(context, rawProps, "hasOnShouldStartLoadWithRequestEvent",
103
+ sourceProps.hasOnShouldStartLoadWithRequestEvent, {false})),
104
+ originWhitelist(convertRawProp(context, rawProps, "originWhitelist", sourceProps.originWhitelist, {})),
105
+ sharedCookiesEnabled(
106
+ convertRawProp(context, rawProps, "sharedCookiesEnabled", sourceProps.sharedCookiesEnabled, {false})),
107
+ textInteractionEnabled(
108
+ convertRawProp(context, rawProps, "textInteractionEnabled", sourceProps.textInteractionEnabled, {false})),
109
+ useSharedProcessPool(
110
+ convertRawProp(context, rawProps, "useSharedProcessPool", sourceProps.useSharedProcessPool, {false})),
111
+ menuItems(convertRawProp(context, rawProps, "menuItems", sourceProps.menuItems, {})),
112
+ suppressMenuItems(convertRawProp(context, rawProps, "suppressMenuItems", sourceProps.suppressMenuItems, {})),
113
+ hasOnFileDownload(convertRawProp(context, rawProps, "hasOnFileDownload", sourceProps.hasOnFileDownload, {false})),
114
+ fraudulentWebsiteWarningEnabled(convertRawProp(context, rawProps, "fraudulentWebsiteWarningEnabled",
115
+ sourceProps.fraudulentWebsiteWarningEnabled, {false})),
116
+ allowFileAccessFromFileURLs(convertRawProp(context, rawProps, "allowFileAccessFromFileURLs",
117
+ sourceProps.allowFileAccessFromFileURLs, {false})),
118
+ allowUniversalAccessFromFileURLs(convertRawProp(context, rawProps, "allowUniversalAccessFromFileURLs",
119
+ sourceProps.allowUniversalAccessFromFileURLs, {false})),
120
+ applicationNameForUserAgent(convertRawProp(context, rawProps, "applicationNameForUserAgent",
121
+ sourceProps.applicationNameForUserAgent, {})),
122
+ basicAuthCredential(
123
+ convertRawProp(context, rawProps, "basicAuthCredential", sourceProps.basicAuthCredential, {})),
124
+ cacheEnabled(convertRawProp(context, rawProps, "cacheEnabled", sourceProps.cacheEnabled, {false})),
125
+ incognito(convertRawProp(context, rawProps, "incognito", sourceProps.incognito, {false})),
126
+ injectedJavaScript(convertRawProp(context, rawProps, "injectedJavaScript", sourceProps.injectedJavaScript, {})),
127
+ injectedJavaScriptBeforeContentLoaded(convertRawProp(context, rawProps, "injectedJavaScriptBeforeContentLoaded",
128
+ sourceProps.injectedJavaScriptBeforeContentLoaded, {})),
129
+ injectedJavaScriptForMainFrameOnly(convertRawProp(context, rawProps, "injectedJavaScriptForMainFrameOnly",
130
+ sourceProps.injectedJavaScriptForMainFrameOnly, {false})),
131
+ injectedJavaScriptBeforeContentLoadedForMainFrameOnly(
132
+ convertRawProp(context, rawProps, "injectedJavaScriptBeforeContentLoadedForMainFrameOnly",
133
+ sourceProps.injectedJavaScriptBeforeContentLoadedForMainFrameOnly, {false})),
134
+ javaScriptCanOpenWindowsAutomatically(convertRawProp(context, rawProps, "javaScriptCanOpenWindowsAutomatically",
135
+ sourceProps.javaScriptCanOpenWindowsAutomatically, {false})),
136
+ javaScriptEnabled(convertRawProp(context, rawProps, "javaScriptEnabled", sourceProps.javaScriptEnabled, {false})),
137
+ webviewDebuggingEnabled(
138
+ convertRawProp(context, rawProps, "webviewDebuggingEnabled", sourceProps.webviewDebuggingEnabled, {false})),
139
+ mediaPlaybackRequiresUserAction(convertRawProp(context, rawProps, "mediaPlaybackRequiresUserAction",
140
+ sourceProps.mediaPlaybackRequiresUserAction, {false})),
141
+ messagingEnabled(convertRawProp(context, rawProps, "messagingEnabled", sourceProps.messagingEnabled, {false})),
142
+ shouldStartLoadWithRequestEnabled(convertRawProp(context, rawProps, "shouldStartLoadWithRequestEnabled",
143
+ sourceProps.shouldStartLoadWithRequestEnabled, {false})),
144
+ hasOnOpenWindowEvent(
145
+ convertRawProp(context, rawProps, "hasOnOpenWindowEvent", sourceProps.hasOnOpenWindowEvent, {false})),
146
+ showsHorizontalScrollIndicator(convertRawProp(context, rawProps, "showsHorizontalScrollIndicator",
147
+ sourceProps.showsHorizontalScrollIndicator, {false})),
148
+ showsVerticalScrollIndicator(convertRawProp(context, rawProps, "showsVerticalScrollIndicator",
149
+ sourceProps.showsVerticalScrollIndicator, {false})),
150
+ newSource(convertRawProp(context, rawProps, "newSource", sourceProps.newSource, {})),
151
+ userAgent(convertRawProp(context, rawProps, "userAgent", sourceProps.userAgent, {})),
152
+ schemeList(convertRawProp(context, rawProps, "schemeList", sourceProps.schemeList, {})) {}
149
153
 
150
154
  } // namespace react
151
155
  } // namespace facebook
@@ -321,6 +321,8 @@ namespace facebook {
321
321
  bool injectedJavaScriptBeforeContentLoadedForMainFrameOnly{false};
322
322
  bool javaScriptCanOpenWindowsAutomatically{false};
323
323
  bool javaScriptEnabled{false};
324
+ bool hasOnShouldStartLoadWithRequestEvent{false};
325
+ folly::dynamic originWhitelist{};
324
326
  bool webviewDebuggingEnabled{false};
325
327
  bool mediaPlaybackRequiresUserAction{false};
326
328
  bool messagingEnabled{false};
@@ -71,6 +71,7 @@ export interface WebViewProps extends ViewRawProps {
71
71
  incognito: boolean
72
72
  userAgent: string
73
73
  shouldStartLoadWithRequestEnabled: boolean
74
+ hasOnShouldStartLoadWithRequestEvent?: boolean
74
75
  originWhitelist: Array<string>
75
76
  thirdPartyCookiesEnabled: boolean
76
77
  fraudulentWebsiteWarningEnabled: boolean
@@ -114,6 +114,9 @@ export struct RNCWebView {
114
114
  private shouldInterceptLoad: boolean = true
115
115
  private callLoadTimer: number = -1
116
116
  static readonly SHOULD_OVERRIDE_URL_LOADING_TIMEOUT: number = 250
117
+ private debounceTimer: number = -1
118
+ static readonly DEBOUNCE_TIME: number = 100
119
+ private isFirstDebounce: boolean = true
117
120
 
118
121
  aboutToAppear() {
119
122
  try {
@@ -404,9 +407,32 @@ export struct RNCWebView {
404
407
  }
405
408
  return permissionDialogMessage;
406
409
  }
407
-
410
+ originWhitelistToRegex(originWhitelist: string): string {
411
+ const matchOperatorsRegex = /[|\\{}()[\]^$+*?.-]/g;
412
+ return `^${originWhitelist.replace(matchOperatorsRegex, '\\$&').replace(/\\\*/g, '.*')}`;
413
+ }
414
+ extractOrigin(url: string): string {
415
+ const result = /^[A-Za-z][A-Za-z0-9+\-.]+:(\/\/)?[^/]*/.exec(url);
416
+ return result === null ? '' : result[0];
417
+ };
418
+ passesWhitelist(compiledWhitelist: string[], url: string) {
419
+ const origin = this.extractOrigin(url);
420
+ return compiledWhitelist.some((x) => new RegExp(x).test(origin));
421
+ };
422
+ compileWhitelist(originWhitelist: string[]): string[] {
423
+ return ['about:blank', ...(originWhitelist || [])].map(this.originWhitelistToRegex);
424
+ }
408
425
  onLoadIntercept(event: OnLoadInterceptEvent): boolean {
409
426
  Logger.debug(TAG, `onLoadIntercept start`)
427
+ let originWhitelistArr = this.descriptorWrapper.rawProps.originWhitelist;
428
+ let hasOnShouldStartLoadWithRequestEventBool = this.descriptorWrapper.rawProps.hasOnShouldStartLoadWithRequestEvent
429
+ let urlString =
430
+ this.webViewBaseOperate?.verifyURLFormat(event.data.getRequestUrl(), this.source.html, this.source.baseUrl) || "";
431
+
432
+ if (this.passesWhitelist(this.compileWhitelist(originWhitelistArr), urlString) &&
433
+ !hasOnShouldStartLoadWithRequestEventBool) {
434
+ return false
435
+ }
410
436
  this.webViewBaseOperate?.setLockIdentifier(BaseOperate.generateLockIdentifier())
411
437
 
412
438
  const params = new ShouldStartParams();
@@ -643,9 +669,25 @@ export struct RNCWebView {
643
669
  }
644
670
  })
645
671
  }
646
- // this.html = this.source.html
647
- this.webviewWidth = this.descriptorWrapper.layoutMetrics.frame.size.width
648
- this.webviewHeight = this.descriptorWrapper.layoutMetrics.frame.size.height
672
+ // 防抖处理webview尺寸设置
673
+ const newWidth = this.descriptorWrapper.layoutMetrics.frame.size.width
674
+ const newHeight = this.descriptorWrapper.layoutMetrics.frame.size.height
675
+
676
+ if (this.debounceTimer !== -1) {
677
+ clearTimeout(this.debounceTimer)
678
+ this.debounceTimer = -1
679
+ }
680
+
681
+ if (this.isFirstDebounce) {
682
+ this.webviewWidth = newWidth
683
+ this.webviewHeight = newHeight
684
+ this.isFirstDebounce = false // 标记为非首次
685
+ } else {
686
+ this.debounceTimer = setTimeout(() => {
687
+ this.webviewWidth = newWidth
688
+ this.webviewHeight = newHeight
689
+ }, RNCWebView.DEBOUNCE_TIME)
690
+ }
649
691
  this.scrollEnabled = this.descriptorWrapper.rawProps.scrollEnabled;
650
692
  // 当禁止滚动时,使用父组件滚动
651
693
  this.nestedScroll = this.scrollEnabled ? NestedScrollMode.SELF_FIRST : NestedScrollMode.PARENT_FIRST;
@@ -86,6 +86,8 @@ export namespace RNCWebView {
86
86
  injectedJavaScriptBeforeContentLoadedForMainFrameOnly?: boolean;
87
87
  javaScriptCanOpenWindowsAutomatically?: boolean;
88
88
  javaScriptEnabled?: boolean;
89
+ hasOnShouldStartLoadWithRequestEvent?:boolean,
90
+ originWhitelist?:readonly string[];
89
91
  webviewDebuggingEnabled?: boolean;
90
92
  mediaPlaybackRequiresUserAction?: boolean;
91
93
  messagingEnabled: boolean;
Binary file
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "Thibault Malbranche <malbranche.thibault@gmail.com>"
10
10
  ],
11
11
  "license": "MIT",
12
- "version": "13.10.5-rc.5",
12
+ "version": "13.10.5-rc.6",
13
13
  "homepage": "https://github.com/react-native-oh-library/react-native-webview#readme",
14
14
  "scripts": {
15
15
  "macos": "react-native run-macos --scheme WebviewExample --project-path example/macos",
@@ -246,6 +246,8 @@ export interface NativeProps extends ViewProps {
246
246
  hasOnOpenWindowEvent?: boolean;
247
247
  onScroll?: DirectEventHandler<ScrollEvent>;
248
248
  onShouldStartLoadWithRequest: DirectEventHandler<ShouldStartLoadRequestEvent>;
249
+ hasOnShouldStartLoadWithRequestEvent?: boolean;
250
+ originWhitelist?:readonly string[];
249
251
  showsHorizontalScrollIndicator?: boolean;
250
252
  showsVerticalScrollIndicator?: boolean;
251
253
  newSource: UnsafeMixed<Readonly<{
@@ -275,6 +275,8 @@ const WebViewComponent = forwardRef<{}, IOSWebViewProps & { scalesPageToFit: boo
275
275
  onOpenWindow={onOpenWindowProp && onOpenWindow}
276
276
  hasOnOpenWindowEvent={onOpenWindowProp !== undefined}
277
277
  onShouldStartLoadWithRequest={onShouldStartLoadWithRequest}
278
+ originWhitelist={originWhitelist}
279
+ hasOnShouldStartLoadWithRequestEvent={onShouldStartLoadWithRequestProp !== undefined}
278
280
  onContentProcessDidTerminate={onContentProcessDidTerminate}
279
281
  thirdPartyCookiesEnabled={thirdPartyCookiesEnabled}
280
282
  pullToRefreshEnabled={pullToRefreshEnabled}