@react-native-ohos/react-native-webview 13.10.6-beta.3 → 13.10.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.
- package/CHANGELOG.md +16 -0
- package/LICENSE +21 -21
- package/README.md +385 -393
- package/harmony/rn_webview/.gitignore +6 -0
- package/harmony/rn_webview/BuildProfile.ets +1 -1
- package/harmony/rn_webview/LICENSE +21 -21
- package/harmony/rn_webview/NOTICE +33 -33
- package/harmony/rn_webview/OAT.xml +44 -44
- package/harmony/rn_webview/README.OpenSource +10 -10
- package/harmony/rn_webview/build-profile.json5 +28 -28
- package/harmony/rn_webview/index.ets +33 -33
- package/harmony/rn_webview/obfuscation-rules.txt +17 -17
- package/harmony/rn_webview/oh-package-lock.json5 +18 -18
- package/harmony/rn_webview/oh-package.json5 +13 -13
- package/harmony/rn_webview/src/main/cpp/CMakeLists.txt +9 -9
- package/harmony/rn_webview/src/main/cpp/WebViewPackage.h +36 -36
- package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/BaseReactNativeWebviewPackage.h +94 -94
- package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/components/RNCWebViewJSIBinder.h +129 -128
- package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/turbo_modules/RNCWebView.cpp +20 -20
- package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/turbo_modules/RNCWebView.h +16 -16
- package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/turbo_modules/RNCWebViewModule.cpp +19 -19
- package/harmony/rn_webview/src/main/cpp/generated/RNOH/generated/turbo_modules/RNCWebViewModule.h +16 -16
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/ComponentDescriptors.h +22 -22
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/EventEmitters.cpp +240 -240
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/EventEmitters.h +285 -285
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/Props.cpp +156 -155
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/Props.h +340 -339
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/ShadowNodes.cpp +19 -19
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/ShadowNodes.h +34 -34
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/States.cpp +16 -16
- package/harmony/rn_webview/src/main/cpp/generated/react/renderer/components/react_native_webview/States.h +19 -19
- package/harmony/rn_webview/src/main/ets/CutomReference.ts +49 -49
- package/harmony/rn_webview/src/main/ets/Logger.ts +63 -63
- package/harmony/rn_webview/src/main/ets/Magic.ets +223 -221
- package/harmony/rn_webview/src/main/ets/RNCWebView.ets +1098 -903
- package/harmony/rn_webview/src/main/ets/RNCWebViewPackage.ets +65 -65
- package/harmony/rn_webview/src/main/ets/ShouldRequestUrl.ts +67 -67
- package/harmony/rn_webview/src/main/ets/WebViewBaseOperate.ets +490 -490
- package/harmony/rn_webview/src/main/ets/WebViewTurboModule.ets +81 -81
- package/harmony/rn_webview/src/main/ets/generated/components/RNCWebView.ts +516 -511
- package/harmony/rn_webview/src/main/ets/generated/components/ts.ts +5 -5
- package/harmony/rn_webview/src/main/ets/generated/index.ets +5 -5
- package/harmony/rn_webview/src/main/ets/generated/ts.ts +6 -6
- package/harmony/rn_webview/src/main/ets/generated/turboModules/RNCWebView.ts +18 -18
- package/harmony/rn_webview/src/main/ets/generated/turboModules/RNCWebViewModule.ts +16 -16
- package/harmony/rn_webview/src/main/ets/generated/turboModules/ts.ts +6 -6
- package/harmony/rn_webview/src/main/module.json5 +10 -10
- package/harmony/rn_webview/src/main/resources/base/element/string.json +39 -39
- package/harmony/rn_webview/src/main/resources/en_US/element/string.json +39 -39
- package/harmony/rn_webview/src/main/resources/zh_CN/element/string.json +39 -39
- package/harmony/rn_webview/src/test/List.test.ets +4 -4
- package/harmony/rn_webview/src/test/LocalUnit.test.ets +32 -32
- package/harmony/rn_webview/ts.ets +28 -28
- package/harmony/rn_webview.har +0 -0
- package/package.json +105 -104
- package/src/NativeRNCWebView.ts +15 -15
- package/src/NativeRNCWebViewModule.ts +17 -17
- package/src/RNCWebViewNativeComponent.ts +289 -288
- package/src/WebView.harmony.tsx +331 -331
- package/src/WebView.tsx +4 -4
- package/src/codegenUtils.ts +8 -8
- package/src/index.ts +4 -4
|
@@ -1,288 +1,289 @@
|
|
|
1
|
-
import type { HostComponent, ViewProps } from 'react-native';
|
|
2
|
-
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
3
|
-
import {DirectEventHandler,Double, Int32, WithDefault} from 'react-native/Libraries/Types/CodegenTypes';
|
|
4
|
-
import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
|
|
5
|
-
import type { UnsafeMixed } from './codegenUtils';
|
|
6
|
-
|
|
7
|
-
export type WebViewNativeEvent = Readonly<{
|
|
8
|
-
url: string;
|
|
9
|
-
loading: boolean;
|
|
10
|
-
title: string;
|
|
11
|
-
canGoBack: boolean;
|
|
12
|
-
canGoForward: boolean;
|
|
13
|
-
lockIdentifier: Double;
|
|
14
|
-
}>
|
|
15
|
-
export type WebViewCustomMenuSelectionEvent = Readonly<{
|
|
16
|
-
label: string;
|
|
17
|
-
key: string;
|
|
18
|
-
selectedText: string;
|
|
19
|
-
}>
|
|
20
|
-
export type WebViewMessageEvent = Readonly<{
|
|
21
|
-
url: string;
|
|
22
|
-
loading: boolean;
|
|
23
|
-
title: string;
|
|
24
|
-
canGoBack: boolean;
|
|
25
|
-
canGoForward: boolean;
|
|
26
|
-
lockIdentifier: Double;
|
|
27
|
-
data: string;
|
|
28
|
-
}>
|
|
29
|
-
export type WebViewOpenWindowEvent = Readonly<{
|
|
30
|
-
targetUrl: string;
|
|
31
|
-
}>
|
|
32
|
-
export type WebViewHttpErrorEvent = Readonly<{
|
|
33
|
-
url: string;
|
|
34
|
-
loading: boolean;
|
|
35
|
-
title: string;
|
|
36
|
-
canGoBack: boolean;
|
|
37
|
-
canGoForward: boolean;
|
|
38
|
-
lockIdentifier: Double;
|
|
39
|
-
description: string;
|
|
40
|
-
statusCode: Int32;
|
|
41
|
-
}>
|
|
42
|
-
|
|
43
|
-
export type WebViewErrorEvent = Readonly<{
|
|
44
|
-
url: string;
|
|
45
|
-
loading: boolean;
|
|
46
|
-
title: string;
|
|
47
|
-
canGoBack: boolean;
|
|
48
|
-
canGoForward: boolean;
|
|
49
|
-
lockIdentifier: Double;
|
|
50
|
-
domain?: string;
|
|
51
|
-
code: Int32;
|
|
52
|
-
description: string;
|
|
53
|
-
}>
|
|
54
|
-
|
|
55
|
-
export type WebViewNativeProgressEvent = Readonly< {
|
|
56
|
-
url: string;
|
|
57
|
-
loading: boolean;
|
|
58
|
-
title: string;
|
|
59
|
-
canGoBack: boolean;
|
|
60
|
-
canGoForward: boolean;
|
|
61
|
-
lockIdentifier: Double;
|
|
62
|
-
progress: Double;
|
|
63
|
-
}>
|
|
64
|
-
|
|
65
|
-
export type WebViewNavigationEvent = Readonly< {
|
|
66
|
-
url: string;
|
|
67
|
-
loading: boolean;
|
|
68
|
-
title: string;
|
|
69
|
-
canGoBack: boolean;
|
|
70
|
-
canGoForward: boolean;
|
|
71
|
-
lockIdentifier: Double;
|
|
72
|
-
navigationType:
|
|
73
|
-
| 'click'
|
|
74
|
-
| 'formsubmit'
|
|
75
|
-
| 'backforward'
|
|
76
|
-
| 'reload'
|
|
77
|
-
| 'formresubmit'
|
|
78
|
-
| 'other';
|
|
79
|
-
mainDocumentURL?: string;
|
|
80
|
-
}>
|
|
81
|
-
|
|
82
|
-
export type ShouldStartLoadRequestEvent = Readonly<{
|
|
83
|
-
url: string;
|
|
84
|
-
loading: boolean;
|
|
85
|
-
title: string;
|
|
86
|
-
canGoBack: boolean;
|
|
87
|
-
canGoForward: boolean;
|
|
88
|
-
lockIdentifier: Double;
|
|
89
|
-
navigationType:
|
|
90
|
-
| 'click'
|
|
91
|
-
| 'formsubmit'
|
|
92
|
-
| 'backforward'
|
|
93
|
-
| 'reload'
|
|
94
|
-
| 'formresubmit'
|
|
95
|
-
| 'other';
|
|
96
|
-
mainDocumentURL?: string;
|
|
97
|
-
isTopFrame: boolean;
|
|
98
|
-
}>
|
|
99
|
-
|
|
100
|
-
type ScrollEvent = Readonly<{
|
|
101
|
-
contentInset: {
|
|
102
|
-
bottom: Double,
|
|
103
|
-
left: Double,
|
|
104
|
-
right: Double,
|
|
105
|
-
top: Double,
|
|
106
|
-
},
|
|
107
|
-
contentOffset: {
|
|
108
|
-
y: Double,
|
|
109
|
-
x: Double,
|
|
110
|
-
},
|
|
111
|
-
contentSize: {
|
|
112
|
-
height: Double,
|
|
113
|
-
width: Double,
|
|
114
|
-
},
|
|
115
|
-
layoutMeasurement: {
|
|
116
|
-
height: Double,
|
|
117
|
-
width: Double,
|
|
118
|
-
},
|
|
119
|
-
targetContentOffset?: {
|
|
120
|
-
y: Double,
|
|
121
|
-
x: Double,
|
|
122
|
-
},
|
|
123
|
-
velocity?: {
|
|
124
|
-
y: Double,
|
|
125
|
-
x: Double,
|
|
126
|
-
},
|
|
127
|
-
zoomScale?: Double,
|
|
128
|
-
responderIgnoreScroll?: boolean,
|
|
129
|
-
}>
|
|
130
|
-
|
|
131
|
-
type WebViewRenderProcessGoneEvent = Readonly<{
|
|
132
|
-
didCrash: boolean;
|
|
133
|
-
}>
|
|
134
|
-
|
|
135
|
-
type WebViewDownloadEvent = Readonly<{
|
|
136
|
-
downloadUrl: string;
|
|
137
|
-
}>
|
|
138
|
-
|
|
139
|
-
// type MenuItem = Readonly<{label: string, key: string}>;
|
|
140
|
-
|
|
141
|
-
export interface NativeProps extends ViewProps {
|
|
142
|
-
// Android only
|
|
143
|
-
allowFileAccess?: boolean;
|
|
144
|
-
allowsProtectedMedia?: boolean;
|
|
145
|
-
allowsFullscreenVideo?: boolean;
|
|
146
|
-
androidLayerType?: WithDefault<'none' | 'software' | 'hardware', 'none'>;
|
|
147
|
-
cacheMode?: WithDefault<'LOAD_DEFAULT' | 'LOAD_CACHE_ELSE_NETWORK' | 'LOAD_NO_CACHE' | 'LOAD_CACHE_ONLY', 'LOAD_DEFAULT'>;
|
|
148
|
-
domStorageEnabled?: boolean;
|
|
149
|
-
downloadingMessage?: string;
|
|
150
|
-
forceDarkOn?: boolean;
|
|
151
|
-
geolocationEnabled?: WithDefault<boolean, false>;
|
|
152
|
-
lackPermissionToDownloadMessage?: string;
|
|
153
|
-
messagingModuleName: string;
|
|
154
|
-
minimumFontSize?: Int32;
|
|
155
|
-
mixedContentMode?: WithDefault<'never' | 'always' | 'compatibility', 'never'>;
|
|
156
|
-
nestedScrollEnabled?: boolean;
|
|
157
|
-
onContentSizeChange?: DirectEventHandler<WebViewNativeEvent>;
|
|
158
|
-
onRenderProcessGone?: DirectEventHandler<WebViewRenderProcessGoneEvent>;
|
|
159
|
-
overScrollMode?: string;
|
|
160
|
-
saveFormDataDisabled?: boolean;
|
|
161
|
-
scalesPageToFit?: boolean;
|
|
162
|
-
setBuiltInZoomControls?: boolean;
|
|
163
|
-
setDisplayZoomControls?: boolean;
|
|
164
|
-
setSupportMultipleWindows?: boolean;
|
|
165
|
-
textZoom?: Int32;
|
|
166
|
-
thirdPartyCookiesEnabled?: boolean;
|
|
167
|
-
// Workaround to watch if listener if defined
|
|
168
|
-
hasOnScroll?: boolean;
|
|
169
|
-
injectedJavaScriptObject?: string;
|
|
170
|
-
// !Android only
|
|
171
|
-
|
|
172
|
-
// iOS only
|
|
173
|
-
allowingReadAccessToURL?: string;
|
|
174
|
-
allowsBackForwardNavigationGestures?: boolean;
|
|
175
|
-
allowsInlineMediaPlayback?: boolean;
|
|
176
|
-
allowsAirPlayForMediaPlayback?: boolean;
|
|
177
|
-
allowsLinkPreview?: boolean;
|
|
178
|
-
automaticallyAdjustContentInsets?: boolean;
|
|
179
|
-
ignoreSilentHardwareSwitch?:boolean;
|
|
180
|
-
autoManageStatusBarEnabled?: boolean;
|
|
181
|
-
bounces?: boolean;
|
|
182
|
-
contentInset?: UnsafeMixed<Readonly<{
|
|
183
|
-
top?: Double;
|
|
184
|
-
left?: Double;
|
|
185
|
-
bottom?: Double;
|
|
186
|
-
right?: Double;
|
|
187
|
-
}>>;
|
|
188
|
-
contentInsetAdjustmentBehavior?: WithDefault<'never' | 'automatic' | 'scrollableAxes' | 'always', 'never'>;
|
|
189
|
-
contentMode?: WithDefault<'recommended' | 'mobile' | 'desktop', 'recommended'>;
|
|
190
|
-
dataDetectorTypes?: WithDefault<
|
|
191
|
-
// eslint-disable-next-line @typescript-eslint/array-type
|
|
192
|
-
UnsafeMixed<ReadonlyArray<'address' | 'link' | 'calendarEvent' | 'trackingNumber' | 'flightNumber' | 'lookupSuggestion' | 'phoneNumber' | 'all' | 'none'>>,
|
|
193
|
-
'phoneNumber'
|
|
194
|
-
>;
|
|
195
|
-
decelerationRate?: Double;
|
|
196
|
-
directionalLockEnabled?: boolean;
|
|
197
|
-
enableApplePay?: boolean;
|
|
198
|
-
hideKeyboardAccessoryView?: boolean;
|
|
199
|
-
keyboardDisplayRequiresUserAction?: boolean;
|
|
200
|
-
limitsNavigationsToAppBoundDomains?: boolean;
|
|
201
|
-
mediaCapturePermissionGrantType?: WithDefault<'prompt' | 'grant' | 'deny' | 'grantIfSameHostElsePrompt' | 'grantIfSameHostElseDeny', 'prompt'>;
|
|
202
|
-
pagingEnabled?: boolean;
|
|
203
|
-
pullToRefreshEnabled?: boolean;
|
|
204
|
-
scrollEnabled?: boolean;
|
|
205
|
-
sharedCookiesEnabled?: boolean;
|
|
206
|
-
textInteractionEnabled?: boolean;
|
|
207
|
-
useSharedProcessPool?: boolean;
|
|
208
|
-
onContentProcessDidTerminate?: DirectEventHandler<WebViewNativeEvent>;
|
|
209
|
-
onCustomMenuSelection?: DirectEventHandler<WebViewCustomMenuSelectionEvent>;
|
|
210
|
-
onFileDownload?: DirectEventHandler<WebViewDownloadEvent>;
|
|
211
|
-
// eslint-disable-next-line @typescript-eslint/array-type
|
|
212
|
-
menuItems?: UnsafeMixed<ReadonlyArray<UnsafeMixed<Readonly<{label: string, key: string}>>>>;
|
|
213
|
-
suppressMenuItems?: UnsafeMixed<Readonly<string>>[];
|
|
214
|
-
// Workaround to watch if listener if defined
|
|
215
|
-
hasOnFileDownload?: boolean;
|
|
216
|
-
fraudulentWebsiteWarningEnabled?: boolean;
|
|
217
|
-
|
|
218
|
-
// !iOS only
|
|
219
|
-
|
|
220
|
-
allowFileAccessFromFileURLs?: boolean;
|
|
221
|
-
allowUniversalAccessFromFileURLs?: boolean;
|
|
222
|
-
applicationNameForUserAgent?: string;
|
|
223
|
-
basicAuthCredential?: UnsafeMixed<Readonly<{
|
|
224
|
-
username: string;
|
|
225
|
-
password: string;
|
|
226
|
-
}>>;
|
|
227
|
-
cacheEnabled?: boolean;
|
|
228
|
-
incognito?: boolean;
|
|
229
|
-
injectedJavaScript?: string;
|
|
230
|
-
injectedJavaScriptBeforeContentLoaded?: string;
|
|
231
|
-
injectedJavaScriptForMainFrameOnly?: boolean;
|
|
232
|
-
injectedJavaScriptBeforeContentLoadedForMainFrameOnly?: boolean;
|
|
233
|
-
javaScriptCanOpenWindowsAutomatically?: boolean;
|
|
234
|
-
javaScriptEnabled?: boolean;
|
|
235
|
-
webviewDebuggingEnabled?: WithDefault<boolean, false>;
|
|
236
|
-
mediaPlaybackRequiresUserAction?: boolean;
|
|
237
|
-
messagingEnabled: boolean;
|
|
238
|
-
shouldStartLoadWithRequestEnabled: boolean;
|
|
239
|
-
onLoadingError: DirectEventHandler<WebViewErrorEvent>;
|
|
240
|
-
onLoadingFinish: DirectEventHandler<WebViewNavigationEvent>;
|
|
241
|
-
onLoadingProgress: DirectEventHandler<WebViewNativeProgressEvent>;
|
|
242
|
-
onLoadingStart: DirectEventHandler<WebViewNavigationEvent>;
|
|
243
|
-
onHttpError: DirectEventHandler<WebViewHttpErrorEvent>;
|
|
244
|
-
onMessage: DirectEventHandler<WebViewMessageEvent>;
|
|
245
|
-
onOpenWindow?: DirectEventHandler<WebViewOpenWindowEvent>;
|
|
246
|
-
hasOnOpenWindowEvent?: boolean;
|
|
247
|
-
onScroll?: DirectEventHandler<ScrollEvent>;
|
|
248
|
-
onShouldStartLoadWithRequest: DirectEventHandler<ShouldStartLoadRequestEvent>;
|
|
249
|
-
hasOnShouldStartLoadWithRequestEvent?: boolean;
|
|
250
|
-
originWhitelist?:readonly string[];
|
|
251
|
-
showsHorizontalScrollIndicator?: boolean;
|
|
252
|
-
showsVerticalScrollIndicator?: boolean;
|
|
253
|
-
newSource: UnsafeMixed<Readonly<{
|
|
254
|
-
uri?: string
|
|
255
|
-
method?: string;
|
|
256
|
-
body?: string;
|
|
257
|
-
// eslint-disable-next-line @typescript-eslint/array-type
|
|
258
|
-
headers?: UnsafeMixed<ReadonlyArray<UnsafeMixed<Readonly<{name: string, value: string}>>>>;
|
|
259
|
-
html?: string;
|
|
260
|
-
baseUrl?: string;
|
|
261
|
-
}>>;
|
|
262
|
-
userAgent?: string;
|
|
263
|
-
schemeList?: UnsafeMixed<ReadonlyArray<string>>;
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
1
|
+
import type { HostComponent, ViewProps } from 'react-native';
|
|
2
|
+
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
3
|
+
import {DirectEventHandler,Double, Int32, WithDefault} from 'react-native/Libraries/Types/CodegenTypes';
|
|
4
|
+
import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
|
|
5
|
+
import type { UnsafeMixed } from './codegenUtils';
|
|
6
|
+
|
|
7
|
+
export type WebViewNativeEvent = Readonly<{
|
|
8
|
+
url: string;
|
|
9
|
+
loading: boolean;
|
|
10
|
+
title: string;
|
|
11
|
+
canGoBack: boolean;
|
|
12
|
+
canGoForward: boolean;
|
|
13
|
+
lockIdentifier: Double;
|
|
14
|
+
}>
|
|
15
|
+
export type WebViewCustomMenuSelectionEvent = Readonly<{
|
|
16
|
+
label: string;
|
|
17
|
+
key: string;
|
|
18
|
+
selectedText: string;
|
|
19
|
+
}>
|
|
20
|
+
export type WebViewMessageEvent = Readonly<{
|
|
21
|
+
url: string;
|
|
22
|
+
loading: boolean;
|
|
23
|
+
title: string;
|
|
24
|
+
canGoBack: boolean;
|
|
25
|
+
canGoForward: boolean;
|
|
26
|
+
lockIdentifier: Double;
|
|
27
|
+
data: string;
|
|
28
|
+
}>
|
|
29
|
+
export type WebViewOpenWindowEvent = Readonly<{
|
|
30
|
+
targetUrl: string;
|
|
31
|
+
}>
|
|
32
|
+
export type WebViewHttpErrorEvent = Readonly<{
|
|
33
|
+
url: string;
|
|
34
|
+
loading: boolean;
|
|
35
|
+
title: string;
|
|
36
|
+
canGoBack: boolean;
|
|
37
|
+
canGoForward: boolean;
|
|
38
|
+
lockIdentifier: Double;
|
|
39
|
+
description: string;
|
|
40
|
+
statusCode: Int32;
|
|
41
|
+
}>
|
|
42
|
+
|
|
43
|
+
export type WebViewErrorEvent = Readonly<{
|
|
44
|
+
url: string;
|
|
45
|
+
loading: boolean;
|
|
46
|
+
title: string;
|
|
47
|
+
canGoBack: boolean;
|
|
48
|
+
canGoForward: boolean;
|
|
49
|
+
lockIdentifier: Double;
|
|
50
|
+
domain?: string;
|
|
51
|
+
code: Int32;
|
|
52
|
+
description: string;
|
|
53
|
+
}>
|
|
54
|
+
|
|
55
|
+
export type WebViewNativeProgressEvent = Readonly< {
|
|
56
|
+
url: string;
|
|
57
|
+
loading: boolean;
|
|
58
|
+
title: string;
|
|
59
|
+
canGoBack: boolean;
|
|
60
|
+
canGoForward: boolean;
|
|
61
|
+
lockIdentifier: Double;
|
|
62
|
+
progress: Double;
|
|
63
|
+
}>
|
|
64
|
+
|
|
65
|
+
export type WebViewNavigationEvent = Readonly< {
|
|
66
|
+
url: string;
|
|
67
|
+
loading: boolean;
|
|
68
|
+
title: string;
|
|
69
|
+
canGoBack: boolean;
|
|
70
|
+
canGoForward: boolean;
|
|
71
|
+
lockIdentifier: Double;
|
|
72
|
+
navigationType:
|
|
73
|
+
| 'click'
|
|
74
|
+
| 'formsubmit'
|
|
75
|
+
| 'backforward'
|
|
76
|
+
| 'reload'
|
|
77
|
+
| 'formresubmit'
|
|
78
|
+
| 'other';
|
|
79
|
+
mainDocumentURL?: string;
|
|
80
|
+
}>
|
|
81
|
+
|
|
82
|
+
export type ShouldStartLoadRequestEvent = Readonly<{
|
|
83
|
+
url: string;
|
|
84
|
+
loading: boolean;
|
|
85
|
+
title: string;
|
|
86
|
+
canGoBack: boolean;
|
|
87
|
+
canGoForward: boolean;
|
|
88
|
+
lockIdentifier: Double;
|
|
89
|
+
navigationType:
|
|
90
|
+
| 'click'
|
|
91
|
+
| 'formsubmit'
|
|
92
|
+
| 'backforward'
|
|
93
|
+
| 'reload'
|
|
94
|
+
| 'formresubmit'
|
|
95
|
+
| 'other';
|
|
96
|
+
mainDocumentURL?: string;
|
|
97
|
+
isTopFrame: boolean;
|
|
98
|
+
}>
|
|
99
|
+
|
|
100
|
+
type ScrollEvent = Readonly<{
|
|
101
|
+
contentInset: {
|
|
102
|
+
bottom: Double,
|
|
103
|
+
left: Double,
|
|
104
|
+
right: Double,
|
|
105
|
+
top: Double,
|
|
106
|
+
},
|
|
107
|
+
contentOffset: {
|
|
108
|
+
y: Double,
|
|
109
|
+
x: Double,
|
|
110
|
+
},
|
|
111
|
+
contentSize: {
|
|
112
|
+
height: Double,
|
|
113
|
+
width: Double,
|
|
114
|
+
},
|
|
115
|
+
layoutMeasurement: {
|
|
116
|
+
height: Double,
|
|
117
|
+
width: Double,
|
|
118
|
+
},
|
|
119
|
+
targetContentOffset?: {
|
|
120
|
+
y: Double,
|
|
121
|
+
x: Double,
|
|
122
|
+
},
|
|
123
|
+
velocity?: {
|
|
124
|
+
y: Double,
|
|
125
|
+
x: Double,
|
|
126
|
+
},
|
|
127
|
+
zoomScale?: Double,
|
|
128
|
+
responderIgnoreScroll?: boolean,
|
|
129
|
+
}>
|
|
130
|
+
|
|
131
|
+
type WebViewRenderProcessGoneEvent = Readonly<{
|
|
132
|
+
didCrash: boolean;
|
|
133
|
+
}>
|
|
134
|
+
|
|
135
|
+
type WebViewDownloadEvent = Readonly<{
|
|
136
|
+
downloadUrl: string;
|
|
137
|
+
}>
|
|
138
|
+
|
|
139
|
+
// type MenuItem = Readonly<{label: string, key: string}>;
|
|
140
|
+
|
|
141
|
+
export interface NativeProps extends ViewProps {
|
|
142
|
+
// Android only
|
|
143
|
+
allowFileAccess?: boolean;
|
|
144
|
+
allowsProtectedMedia?: boolean;
|
|
145
|
+
allowsFullscreenVideo?: boolean;
|
|
146
|
+
androidLayerType?: WithDefault<'none' | 'software' | 'hardware', 'none'>;
|
|
147
|
+
cacheMode?: WithDefault<'LOAD_DEFAULT' | 'LOAD_CACHE_ELSE_NETWORK' | 'LOAD_NO_CACHE' | 'LOAD_CACHE_ONLY', 'LOAD_DEFAULT'>;
|
|
148
|
+
domStorageEnabled?: boolean;
|
|
149
|
+
downloadingMessage?: string;
|
|
150
|
+
forceDarkOn?: boolean;
|
|
151
|
+
geolocationEnabled?: WithDefault<boolean, false>;
|
|
152
|
+
lackPermissionToDownloadMessage?: string;
|
|
153
|
+
messagingModuleName: string;
|
|
154
|
+
minimumFontSize?: Int32;
|
|
155
|
+
mixedContentMode?: WithDefault<'never' | 'always' | 'compatibility', 'never'>;
|
|
156
|
+
nestedScrollEnabled?: boolean;
|
|
157
|
+
onContentSizeChange?: DirectEventHandler<WebViewNativeEvent>;
|
|
158
|
+
onRenderProcessGone?: DirectEventHandler<WebViewRenderProcessGoneEvent>;
|
|
159
|
+
overScrollMode?: string;
|
|
160
|
+
saveFormDataDisabled?: boolean;
|
|
161
|
+
scalesPageToFit?: boolean;
|
|
162
|
+
setBuiltInZoomControls?: boolean;
|
|
163
|
+
setDisplayZoomControls?: boolean;
|
|
164
|
+
setSupportMultipleWindows?: boolean;
|
|
165
|
+
textZoom?: Int32;
|
|
166
|
+
thirdPartyCookiesEnabled?: boolean;
|
|
167
|
+
// Workaround to watch if listener if defined
|
|
168
|
+
hasOnScroll?: boolean;
|
|
169
|
+
injectedJavaScriptObject?: string;
|
|
170
|
+
// !Android only
|
|
171
|
+
|
|
172
|
+
// iOS only
|
|
173
|
+
allowingReadAccessToURL?: string;
|
|
174
|
+
allowsBackForwardNavigationGestures?: boolean;
|
|
175
|
+
allowsInlineMediaPlayback?: boolean;
|
|
176
|
+
allowsAirPlayForMediaPlayback?: boolean;
|
|
177
|
+
allowsLinkPreview?: boolean;
|
|
178
|
+
automaticallyAdjustContentInsets?: boolean;
|
|
179
|
+
ignoreSilentHardwareSwitch?:boolean;
|
|
180
|
+
autoManageStatusBarEnabled?: boolean;
|
|
181
|
+
bounces?: boolean;
|
|
182
|
+
contentInset?: UnsafeMixed<Readonly<{
|
|
183
|
+
top?: Double;
|
|
184
|
+
left?: Double;
|
|
185
|
+
bottom?: Double;
|
|
186
|
+
right?: Double;
|
|
187
|
+
}>>;
|
|
188
|
+
contentInsetAdjustmentBehavior?: WithDefault<'never' | 'automatic' | 'scrollableAxes' | 'always', 'never'>;
|
|
189
|
+
contentMode?: WithDefault<'recommended' | 'mobile' | 'desktop', 'recommended'>;
|
|
190
|
+
dataDetectorTypes?: WithDefault<
|
|
191
|
+
// eslint-disable-next-line @typescript-eslint/array-type
|
|
192
|
+
UnsafeMixed<ReadonlyArray<'address' | 'link' | 'calendarEvent' | 'trackingNumber' | 'flightNumber' | 'lookupSuggestion' | 'phoneNumber' | 'all' | 'none'>>,
|
|
193
|
+
'phoneNumber'
|
|
194
|
+
>;
|
|
195
|
+
decelerationRate?: Double;
|
|
196
|
+
directionalLockEnabled?: boolean;
|
|
197
|
+
enableApplePay?: boolean;
|
|
198
|
+
hideKeyboardAccessoryView?: boolean;
|
|
199
|
+
keyboardDisplayRequiresUserAction?: boolean;
|
|
200
|
+
limitsNavigationsToAppBoundDomains?: boolean;
|
|
201
|
+
mediaCapturePermissionGrantType?: WithDefault<'prompt' | 'grant' | 'deny' | 'grantIfSameHostElsePrompt' | 'grantIfSameHostElseDeny', 'prompt'>;
|
|
202
|
+
pagingEnabled?: boolean;
|
|
203
|
+
pullToRefreshEnabled?: boolean;
|
|
204
|
+
scrollEnabled?: boolean;
|
|
205
|
+
sharedCookiesEnabled?: boolean;
|
|
206
|
+
textInteractionEnabled?: boolean;
|
|
207
|
+
useSharedProcessPool?: boolean;
|
|
208
|
+
onContentProcessDidTerminate?: DirectEventHandler<WebViewNativeEvent>;
|
|
209
|
+
onCustomMenuSelection?: DirectEventHandler<WebViewCustomMenuSelectionEvent>;
|
|
210
|
+
onFileDownload?: DirectEventHandler<WebViewDownloadEvent>;
|
|
211
|
+
// eslint-disable-next-line @typescript-eslint/array-type
|
|
212
|
+
menuItems?: UnsafeMixed<ReadonlyArray<UnsafeMixed<Readonly<{label: string, key: string}>>>>;
|
|
213
|
+
suppressMenuItems?: UnsafeMixed<Readonly<string>>[];
|
|
214
|
+
// Workaround to watch if listener if defined
|
|
215
|
+
hasOnFileDownload?: boolean;
|
|
216
|
+
fraudulentWebsiteWarningEnabled?: boolean;
|
|
217
|
+
|
|
218
|
+
// !iOS only
|
|
219
|
+
|
|
220
|
+
allowFileAccessFromFileURLs?: boolean;
|
|
221
|
+
allowUniversalAccessFromFileURLs?: boolean;
|
|
222
|
+
applicationNameForUserAgent?: string;
|
|
223
|
+
basicAuthCredential?: UnsafeMixed<Readonly<{
|
|
224
|
+
username: string;
|
|
225
|
+
password: string;
|
|
226
|
+
}>>;
|
|
227
|
+
cacheEnabled?: boolean;
|
|
228
|
+
incognito?: boolean;
|
|
229
|
+
injectedJavaScript?: string;
|
|
230
|
+
injectedJavaScriptBeforeContentLoaded?: string;
|
|
231
|
+
injectedJavaScriptForMainFrameOnly?: boolean;
|
|
232
|
+
injectedJavaScriptBeforeContentLoadedForMainFrameOnly?: boolean;
|
|
233
|
+
javaScriptCanOpenWindowsAutomatically?: boolean;
|
|
234
|
+
javaScriptEnabled?: boolean;
|
|
235
|
+
webviewDebuggingEnabled?: WithDefault<boolean, false>;
|
|
236
|
+
mediaPlaybackRequiresUserAction?: boolean;
|
|
237
|
+
messagingEnabled: boolean;
|
|
238
|
+
shouldStartLoadWithRequestEnabled: boolean;
|
|
239
|
+
onLoadingError: DirectEventHandler<WebViewErrorEvent>;
|
|
240
|
+
onLoadingFinish: DirectEventHandler<WebViewNavigationEvent>;
|
|
241
|
+
onLoadingProgress: DirectEventHandler<WebViewNativeProgressEvent>;
|
|
242
|
+
onLoadingStart: DirectEventHandler<WebViewNavigationEvent>;
|
|
243
|
+
onHttpError: DirectEventHandler<WebViewHttpErrorEvent>;
|
|
244
|
+
onMessage: DirectEventHandler<WebViewMessageEvent>;
|
|
245
|
+
onOpenWindow?: DirectEventHandler<WebViewOpenWindowEvent>;
|
|
246
|
+
hasOnOpenWindowEvent?: boolean;
|
|
247
|
+
onScroll?: DirectEventHandler<ScrollEvent>;
|
|
248
|
+
onShouldStartLoadWithRequest: DirectEventHandler<ShouldStartLoadRequestEvent>;
|
|
249
|
+
hasOnShouldStartLoadWithRequestEvent?: boolean;
|
|
250
|
+
originWhitelist?:readonly string[];
|
|
251
|
+
showsHorizontalScrollIndicator?: boolean;
|
|
252
|
+
showsVerticalScrollIndicator?: boolean;
|
|
253
|
+
newSource: UnsafeMixed<Readonly<{
|
|
254
|
+
uri?: string
|
|
255
|
+
method?: string;
|
|
256
|
+
body?: string;
|
|
257
|
+
// eslint-disable-next-line @typescript-eslint/array-type
|
|
258
|
+
headers?: UnsafeMixed<ReadonlyArray<UnsafeMixed<Readonly<{name: string, value: string}>>>>;
|
|
259
|
+
html?: string;
|
|
260
|
+
baseUrl?: string;
|
|
261
|
+
}>>;
|
|
262
|
+
userAgent?: string;
|
|
263
|
+
schemeList?: UnsafeMixed<ReadonlyArray<string>>;
|
|
264
|
+
renderMode?: WithDefault<"SYNC_RENDER" | "ASYNC_RENDER", "SYNC_RENDER">;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
export interface NativeCommands {
|
|
268
|
+
goBack: (viewRef: React.ElementRef<HostComponent<NativeProps>> ) => void;
|
|
269
|
+
goForward: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
|
|
270
|
+
reload: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
|
|
271
|
+
stopLoading: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
|
|
272
|
+
injectJavaScript: (viewRef: React.ElementRef<HostComponent<NativeProps>>, javascript: string) => void;
|
|
273
|
+
requestFocus: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
|
|
274
|
+
postMessage: (viewRef: React.ElementRef<HostComponent<NativeProps>>, data: string) => void;
|
|
275
|
+
// Android Only
|
|
276
|
+
loadUrl: (viewRef: React.ElementRef<HostComponent<NativeProps>>, url: string) => void;
|
|
277
|
+
clearFormData: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
|
|
278
|
+
clearCache: (viewRef: React.ElementRef<HostComponent<NativeProps>>, includeDiskFiles: boolean) => void;
|
|
279
|
+
clearHistory: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
|
|
280
|
+
// !Android Only
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
export const Commands = codegenNativeCommands<NativeCommands>({
|
|
284
|
+
supportedCommands: ['goBack', 'goForward', 'reload', 'stopLoading', 'injectJavaScript', 'requestFocus', 'postMessage', 'loadUrl', 'clearFormData', 'clearCache', 'clearHistory'],
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
export default codegenNativeComponent<NativeProps>(
|
|
288
|
+
'RNCWebView'
|
|
289
|
+
) as HostComponent<NativeProps>;
|