@exodus/react-native-webview 13.16.0-exodus.3 → 13.16.0-exodus.5
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/src/main/java/com/reactnativecommunity/webview/RNCWebChromeClient.java +15 -18
- package/android/src/main/java/com/reactnativecommunity/webview/RNCWebView.java +0 -7
- package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewClient.java +0 -21
- package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManagerImpl.kt +5 -50
- package/android/src/newarch/com/reactnativecommunity/webview/RNCWebViewManager.java +0 -58
- package/android/src/oldarch/com/reactnativecommunity/webview/RNCWebViewManager.java +0 -40
- package/apple/RNCWebView.mm +0 -39
- package/apple/RNCWebViewDecisionManager.m +17 -0
- package/apple/RNCWebViewImpl.h +0 -10
- package/apple/RNCWebViewImpl.m +24 -72
- package/apple/RNCWebViewManager.mm +0 -11
- package/lib/RNCWebViewNativeComponent.d.ts +0 -26
- package/lib/RNCWebViewNativeComponent.js +1 -1
- package/lib/WebView.android.js +1 -1
- package/lib/WebView.d.ts +2 -2
- package/lib/WebView.ios.js +1 -1
- package/lib/WebView.js +1 -1
- package/lib/WebViewShared.d.ts +5 -5
- package/lib/WebViewShared.js +1 -1
- package/lib/WebViewTypes.d.ts +5 -358
- package/lib/WebViewTypes.js +1 -1
- package/package.json +6 -12
- package/react-native-webview.podspec +1 -1
- package/src/RNCWebViewNativeComponent.ts +0 -37
- package/src/WebView.android.tsx +293 -284
- package/src/WebView.ios.tsx +223 -256
- package/src/WebView.tsx +2 -8
- package/src/WebViewShared.tsx +2 -11
- package/src/WebViewTypes.ts +2 -396
- package/android/src/main/java/com/reactnativecommunity/webview/events/TopHttpErrorEvent.kt +0 -25
- package/lib/WebView.macos.d.ts +0 -6
- package/lib/WebView.macos.js +0 -1
- package/lib/WebView.windows.d.ts +0 -17
- package/lib/WebView.windows.js +0 -1
- package/lib/WebViewNativeComponent.windows.d.ts +0 -3
- package/lib/WebViewNativeComponent.windows.js +0 -1
- package/src/WebView.macos.tsx +0 -252
- package/src/WebView.windows.tsx +0 -217
- package/src/WebViewNativeComponent.macos.ts +0 -7
- package/src/WebViewNativeComponent.windows.ts +0 -8
- package/src/__tests__/WebViewShared-test.js +0 -323
- package/src/__tests__/__snapshots__/WebViewShared-test.js.snap +0 -8
- package/src/__tests__/validation-test.js +0 -38
package/src/WebView.ios.tsx
CHANGED
|
@@ -31,6 +31,7 @@ import {
|
|
|
31
31
|
WebViewSourceUri,
|
|
32
32
|
} from './WebViewTypes';
|
|
33
33
|
|
|
34
|
+
import validateProps from './validation';
|
|
34
35
|
import styles from './WebView.styles';
|
|
35
36
|
|
|
36
37
|
const { resolveAssetSource } = Image;
|
|
@@ -72,276 +73,242 @@ const useWarnIfChanges = <T extends unknown>(value: T, name: string) => {
|
|
|
72
73
|
}
|
|
73
74
|
};
|
|
74
75
|
|
|
75
|
-
const WebViewComponent = forwardRef<{}, IOSWebViewProps>(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
fraudulentWebsiteWarningEnabled = true,
|
|
79
|
-
javaScriptEnabled = true,
|
|
80
|
-
cacheEnabled = true,
|
|
81
|
-
originWhitelist = defaultOriginWhitelist,
|
|
82
|
-
deeplinkWhitelist = defaultDeeplinkWhitelist,
|
|
83
|
-
textInteractionEnabled = true,
|
|
84
|
-
injectedJavaScript,
|
|
85
|
-
injectedJavaScriptBeforeContentLoaded,
|
|
86
|
-
injectedJavaScriptForMainFrameOnly = true,
|
|
87
|
-
injectedJavaScriptBeforeContentLoadedForMainFrameOnly = true,
|
|
88
|
-
injectedJavaScriptObject,
|
|
89
|
-
startInLoadingState,
|
|
90
|
-
onNavigationStateChange,
|
|
91
|
-
onLoadStart,
|
|
92
|
-
onError,
|
|
93
|
-
onLoad,
|
|
94
|
-
onLoadEnd,
|
|
95
|
-
onLoadProgress,
|
|
96
|
-
onContentProcessDidTerminate: onContentProcessDidTerminateProp,
|
|
97
|
-
onFileDownload,
|
|
98
|
-
onHttpError: onHttpErrorProp,
|
|
99
|
-
onMessage: onMessageProp,
|
|
100
|
-
onOpenWindow: onOpenWindowProp,
|
|
101
|
-
renderLoading,
|
|
102
|
-
renderError,
|
|
103
|
-
style,
|
|
104
|
-
containerStyle,
|
|
105
|
-
source,
|
|
106
|
-
nativeConfig,
|
|
107
|
-
allowsPictureInPictureMediaPlayback = true,
|
|
108
|
-
allowsAirPlayForMediaPlayback,
|
|
109
|
-
incognito,
|
|
110
|
-
decelerationRate: decelerationRateProp,
|
|
111
|
-
onShouldStartLoadWithRequest: onShouldStartLoadWithRequestProp,
|
|
112
|
-
validateMeta,
|
|
113
|
-
validateData,
|
|
114
|
-
minimumIOSVersion,
|
|
115
|
-
unsupportedVersionComponent: UnsupportedVersionComponent,
|
|
116
|
-
...otherProps
|
|
117
|
-
},
|
|
118
|
-
ref
|
|
119
|
-
) => {
|
|
120
|
-
const webViewRef = useRef<React.ComponentRef<
|
|
121
|
-
HostComponent<NativeProps>
|
|
122
|
-
> | null>(null);
|
|
76
|
+
const WebViewComponent = forwardRef<{}, IOSWebViewProps>((props, ref) => {
|
|
77
|
+
// Exodus: Validate props at runtime
|
|
78
|
+
validateProps(props);
|
|
123
79
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
80
|
+
const {
|
|
81
|
+
fraudulentWebsiteWarningEnabled = true,
|
|
82
|
+
javaScriptEnabled = true,
|
|
83
|
+
cacheEnabled = true,
|
|
84
|
+
originWhitelist = defaultOriginWhitelist,
|
|
85
|
+
deeplinkWhitelist = defaultDeeplinkWhitelist,
|
|
86
|
+
textInteractionEnabled = true,
|
|
87
|
+
injectedJavaScript,
|
|
88
|
+
injectedJavaScriptBeforeContentLoaded,
|
|
89
|
+
injectedJavaScriptObject,
|
|
90
|
+
startInLoadingState,
|
|
91
|
+
onNavigationStateChange,
|
|
92
|
+
onLoadStart,
|
|
93
|
+
onError,
|
|
94
|
+
onLoad,
|
|
95
|
+
onLoadEnd,
|
|
96
|
+
onLoadProgress,
|
|
97
|
+
onContentProcessDidTerminate: onContentProcessDidTerminateProp,
|
|
98
|
+
onMessage: onMessageProp,
|
|
99
|
+
onOpenWindow: onOpenWindowProp,
|
|
100
|
+
renderLoading,
|
|
101
|
+
renderError,
|
|
102
|
+
style,
|
|
103
|
+
containerStyle,
|
|
104
|
+
source,
|
|
105
|
+
allowsPictureInPictureMediaPlayback = true,
|
|
106
|
+
incognito,
|
|
107
|
+
decelerationRate: decelerationRateProp,
|
|
108
|
+
onShouldStartLoadWithRequest: onShouldStartLoadWithRequestProp,
|
|
109
|
+
validateMeta,
|
|
110
|
+
validateData,
|
|
111
|
+
minimumIOSVersion,
|
|
112
|
+
unsupportedVersionComponent: UnsupportedVersionComponent,
|
|
113
|
+
...otherProps
|
|
114
|
+
} = props;
|
|
133
115
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
onMessage,
|
|
138
|
-
viewState,
|
|
139
|
-
setViewState,
|
|
140
|
-
lastErrorEvent,
|
|
141
|
-
onHttpError,
|
|
142
|
-
onLoadingError,
|
|
143
|
-
onLoadingFinish,
|
|
144
|
-
onLoadingProgress,
|
|
145
|
-
onOpenWindow,
|
|
146
|
-
onContentProcessDidTerminate,
|
|
147
|
-
} = useWebViewLogic({
|
|
148
|
-
onNavigationStateChange,
|
|
149
|
-
onLoad,
|
|
150
|
-
onError,
|
|
151
|
-
onHttpErrorProp,
|
|
152
|
-
onLoadEnd,
|
|
153
|
-
onLoadProgress,
|
|
154
|
-
onLoadStart,
|
|
155
|
-
onMessageProp,
|
|
156
|
-
onOpenWindowProp,
|
|
157
|
-
startInLoadingState,
|
|
158
|
-
originWhitelist,
|
|
159
|
-
deeplinkWhitelist,
|
|
160
|
-
onShouldStartLoadWithRequestProp,
|
|
161
|
-
onShouldStartLoadWithRequestCallback,
|
|
162
|
-
onContentProcessDidTerminateProp,
|
|
163
|
-
validateMeta,
|
|
164
|
-
validateData,
|
|
165
|
-
});
|
|
116
|
+
const webViewRef = useRef<React.ComponentRef<
|
|
117
|
+
HostComponent<NativeProps>
|
|
118
|
+
> | null>(null);
|
|
166
119
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
(
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
Commands.reload(webViewRef.current);
|
|
177
|
-
}
|
|
178
|
-
},
|
|
179
|
-
stopLoading: () =>
|
|
180
|
-
webViewRef.current && Commands.stopLoading(webViewRef.current),
|
|
181
|
-
postMessage: (data: string) =>
|
|
182
|
-
webViewRef.current && Commands.postMessage(webViewRef.current, data),
|
|
183
|
-
injectJavaScript: (data: string) =>
|
|
184
|
-
webViewRef.current &&
|
|
185
|
-
Commands.injectJavaScript(webViewRef.current, data),
|
|
186
|
-
requestFocus: () =>
|
|
187
|
-
webViewRef.current && Commands.requestFocus(webViewRef.current),
|
|
188
|
-
clearCache: (includeDiskFiles: boolean) =>
|
|
189
|
-
webViewRef.current &&
|
|
190
|
-
Commands.clearCache(webViewRef.current, includeDiskFiles),
|
|
191
|
-
}),
|
|
192
|
-
[setViewState, webViewRef]
|
|
193
|
-
);
|
|
120
|
+
const onShouldStartLoadWithRequestCallback = useCallback(
|
|
121
|
+
(shouldStart: boolean, _url: string, lockIdentifier = 0) => {
|
|
122
|
+
RNCWebViewModule.shouldStartLoadWithLockIdentifier(
|
|
123
|
+
shouldStart,
|
|
124
|
+
lockIdentifier
|
|
125
|
+
);
|
|
126
|
+
},
|
|
127
|
+
[]
|
|
128
|
+
);
|
|
194
129
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
130
|
+
const {
|
|
131
|
+
onLoadingStart,
|
|
132
|
+
onShouldStartLoadWithRequest,
|
|
133
|
+
onMessage,
|
|
134
|
+
viewState,
|
|
135
|
+
setViewState,
|
|
136
|
+
lastErrorEvent,
|
|
137
|
+
onLoadingError,
|
|
138
|
+
onLoadingFinish,
|
|
139
|
+
onLoadingProgress,
|
|
140
|
+
onOpenWindow,
|
|
141
|
+
onContentProcessDidTerminate,
|
|
142
|
+
} = useWebViewLogic({
|
|
143
|
+
onNavigationStateChange,
|
|
144
|
+
onLoad,
|
|
145
|
+
onError,
|
|
146
|
+
onLoadEnd,
|
|
147
|
+
onLoadProgress,
|
|
148
|
+
onLoadStart,
|
|
149
|
+
onMessageProp,
|
|
150
|
+
onOpenWindowProp,
|
|
151
|
+
startInLoadingState,
|
|
152
|
+
originWhitelist,
|
|
153
|
+
deeplinkWhitelist,
|
|
154
|
+
onShouldStartLoadWithRequestProp,
|
|
155
|
+
onShouldStartLoadWithRequestCallback,
|
|
156
|
+
onContentProcessDidTerminateProp,
|
|
157
|
+
validateMeta,
|
|
158
|
+
validateData,
|
|
159
|
+
});
|
|
213
160
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
161
|
+
useImperativeHandle(
|
|
162
|
+
ref,
|
|
163
|
+
() => ({
|
|
164
|
+
goForward: () =>
|
|
165
|
+
webViewRef.current && Commands.goForward(webViewRef.current),
|
|
166
|
+
goBack: () => webViewRef.current && Commands.goBack(webViewRef.current),
|
|
167
|
+
reload: () => {
|
|
168
|
+
setViewState('LOADING');
|
|
169
|
+
if (webViewRef.current) {
|
|
170
|
+
Commands.reload(webViewRef.current);
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
stopLoading: () =>
|
|
174
|
+
webViewRef.current && Commands.stopLoading(webViewRef.current),
|
|
175
|
+
postMessage: (data: string) =>
|
|
176
|
+
webViewRef.current && Commands.postMessage(webViewRef.current, data),
|
|
177
|
+
requestFocus: () =>
|
|
178
|
+
webViewRef.current && Commands.requestFocus(webViewRef.current),
|
|
179
|
+
clearCache: (includeDiskFiles: boolean) =>
|
|
180
|
+
webViewRef.current &&
|
|
181
|
+
Commands.clearCache(webViewRef.current, includeDiskFiles),
|
|
182
|
+
}),
|
|
183
|
+
[setViewState, webViewRef]
|
|
184
|
+
);
|
|
220
185
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
186
|
+
useWarnIfChanges(
|
|
187
|
+
securityAllowsInlineMediaPlayback,
|
|
188
|
+
'allowsInlineMediaPlayback'
|
|
189
|
+
);
|
|
190
|
+
useWarnIfChanges(
|
|
191
|
+
allowsPictureInPictureMediaPlayback,
|
|
192
|
+
'allowsPictureInPictureMediaPlayback'
|
|
193
|
+
);
|
|
194
|
+
useWarnIfChanges(incognito, 'incognito');
|
|
195
|
+
useWarnIfChanges(
|
|
196
|
+
securityMediaPlaybackRequiresUserAction,
|
|
197
|
+
'mediaPlaybackRequiresUserAction'
|
|
198
|
+
);
|
|
199
|
+
useWarnIfChanges(securityDataDetectorTypes, 'dataDetectorTypes');
|
|
233
200
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
lastErrorEvent?.code ?? 0,
|
|
245
|
-
lastErrorEvent?.description ?? ''
|
|
246
|
-
);
|
|
247
|
-
} else if (viewState !== 'IDLE') {
|
|
248
|
-
console.error(`RNCWebView invalid state encountered: ${viewState}`);
|
|
201
|
+
// Exodus: Check iOS version against minimum requirements
|
|
202
|
+
const iosVersion = String(Platform.Version);
|
|
203
|
+
const passesMinimum = minimumIOSVersion
|
|
204
|
+
? versionPasses(iosVersion, minimumIOSVersion)
|
|
205
|
+
: true;
|
|
206
|
+
const passesHardMinimum = versionPasses(iosVersion, hardMinimumIOSVersion);
|
|
207
|
+
|
|
208
|
+
if (!passesMinimum || !passesHardMinimum) {
|
|
209
|
+
if (UnsupportedVersionComponent) {
|
|
210
|
+
return <UnsupportedVersionComponent />;
|
|
249
211
|
}
|
|
212
|
+
return (
|
|
213
|
+
<View style={{ alignSelf: 'flex-start' }}>
|
|
214
|
+
<Text style={{ color: 'red' }}>
|
|
215
|
+
iOS version is outdated and insecure. Update it to continue.
|
|
216
|
+
</Text>
|
|
217
|
+
</View>
|
|
218
|
+
);
|
|
219
|
+
}
|
|
250
220
|
|
|
251
|
-
|
|
252
|
-
|
|
221
|
+
let otherView = null;
|
|
222
|
+
if (viewState === 'LOADING') {
|
|
223
|
+
otherView = (renderLoading || defaultRenderLoading)();
|
|
224
|
+
} else if (viewState === 'ERROR') {
|
|
225
|
+
invariant(lastErrorEvent != null, 'lastErrorEvent expected to be non-null');
|
|
226
|
+
otherView = (renderError || defaultRenderError)(
|
|
227
|
+
lastErrorEvent?.domain,
|
|
228
|
+
lastErrorEvent?.code ?? 0,
|
|
229
|
+
lastErrorEvent?.description ?? ''
|
|
230
|
+
);
|
|
231
|
+
} else if (viewState !== 'IDLE') {
|
|
232
|
+
console.error(`RNCWebView invalid state encountered: ${viewState}`);
|
|
233
|
+
}
|
|
253
234
|
|
|
254
|
-
|
|
235
|
+
const webViewStyles = [styles.container, styles.webView, style];
|
|
236
|
+
const webViewContainerStyle = [styles.container, containerStyle];
|
|
255
237
|
|
|
256
|
-
|
|
257
|
-
(nativeConfig?.component as typeof RNCWebView | undefined) || RNCWebView;
|
|
238
|
+
const decelerationRate = processDecelerationRate(decelerationRateProp);
|
|
258
239
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
240
|
+
const sourceResolved = resolveAssetSource(source as ImageSourcePropType);
|
|
241
|
+
const newSource =
|
|
242
|
+
typeof sourceResolved === 'object'
|
|
243
|
+
? Object.entries(sourceResolved as WebViewSourceUri).reduce(
|
|
244
|
+
(prev, [currKey, currValue]) => {
|
|
245
|
+
return {
|
|
246
|
+
...prev,
|
|
247
|
+
[currKey]:
|
|
248
|
+
currKey === 'headers' &&
|
|
249
|
+
currValue &&
|
|
250
|
+
typeof currValue === 'object'
|
|
251
|
+
? Object.entries(currValue).map(([key, value]) => {
|
|
252
|
+
return {
|
|
253
|
+
name: key,
|
|
254
|
+
value,
|
|
255
|
+
};
|
|
256
|
+
})
|
|
257
|
+
: currValue,
|
|
258
|
+
};
|
|
259
|
+
},
|
|
260
|
+
{}
|
|
261
|
+
)
|
|
262
|
+
: sourceResolved;
|
|
282
263
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
incognito={incognito}
|
|
324
|
-
mediaPlaybackRequiresUserAction={
|
|
325
|
-
securityMediaPlaybackRequiresUserAction
|
|
326
|
-
}
|
|
327
|
-
newSource={newSource}
|
|
328
|
-
style={webViewStyles}
|
|
329
|
-
hasOnFileDownload={!!onFileDownload}
|
|
330
|
-
ref={webViewRef}
|
|
331
|
-
// @ts-expect-error source prop for old arch compatibility
|
|
332
|
-
source={sourceResolved}
|
|
333
|
-
{...nativeConfig?.props}
|
|
334
|
-
/>
|
|
335
|
-
);
|
|
264
|
+
const webView = (
|
|
265
|
+
<RNCWebView
|
|
266
|
+
key="webViewKey"
|
|
267
|
+
{...otherProps}
|
|
268
|
+
fraudulentWebsiteWarningEnabled={fraudulentWebsiteWarningEnabled}
|
|
269
|
+
javaScriptEnabled={javaScriptEnabled}
|
|
270
|
+
cacheEnabled={cacheEnabled}
|
|
271
|
+
useSharedProcessPool={securityUseSharedProcessPool}
|
|
272
|
+
sharedCookiesEnabled={securitySharedCookiesEnabled}
|
|
273
|
+
enableApplePay={securityEnableApplePay}
|
|
274
|
+
textInteractionEnabled={textInteractionEnabled}
|
|
275
|
+
decelerationRate={decelerationRate}
|
|
276
|
+
messagingEnabled={typeof onMessageProp === 'function'}
|
|
277
|
+
messagingModuleName="" // android ONLY
|
|
278
|
+
onLoadingError={onLoadingError}
|
|
279
|
+
onLoadingFinish={onLoadingFinish}
|
|
280
|
+
onLoadingProgress={onLoadingProgress}
|
|
281
|
+
onLoadingStart={onLoadingStart}
|
|
282
|
+
onMessage={onMessage}
|
|
283
|
+
onOpenWindow={onOpenWindowProp && onOpenWindow}
|
|
284
|
+
hasOnOpenWindowEvent={onOpenWindowProp !== undefined}
|
|
285
|
+
onShouldStartLoadWithRequest={onShouldStartLoadWithRequest}
|
|
286
|
+
onContentProcessDidTerminate={onContentProcessDidTerminate}
|
|
287
|
+
injectedJavaScript={injectedJavaScript}
|
|
288
|
+
injectedJavaScriptBeforeContentLoaded={
|
|
289
|
+
injectedJavaScriptBeforeContentLoaded
|
|
290
|
+
}
|
|
291
|
+
injectedJavaScriptObject={JSON.stringify(injectedJavaScriptObject)}
|
|
292
|
+
dataDetectorTypes={securityDataDetectorTypes}
|
|
293
|
+
allowsInlineMediaPlayback={securityAllowsInlineMediaPlayback}
|
|
294
|
+
allowsPictureInPictureMediaPlayback={allowsPictureInPictureMediaPlayback}
|
|
295
|
+
incognito={incognito}
|
|
296
|
+
mediaPlaybackRequiresUserAction={securityMediaPlaybackRequiresUserAction}
|
|
297
|
+
newSource={newSource}
|
|
298
|
+
style={webViewStyles}
|
|
299
|
+
ref={webViewRef}
|
|
300
|
+
// @ts-expect-error source prop for old arch compatibility
|
|
301
|
+
source={sourceResolved}
|
|
302
|
+
/>
|
|
303
|
+
);
|
|
336
304
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
);
|
|
305
|
+
return (
|
|
306
|
+
<View style={webViewContainerStyle}>
|
|
307
|
+
{webView}
|
|
308
|
+
{otherView}
|
|
309
|
+
</View>
|
|
310
|
+
);
|
|
311
|
+
});
|
|
345
312
|
|
|
346
313
|
// no native implementation for iOS, depends only on permissions
|
|
347
314
|
const isFileUploadSupported: () => Promise<boolean> = async () => true;
|
package/src/WebView.tsx
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Text, View } from 'react-native';
|
|
3
|
-
import {
|
|
4
|
-
IOSWebViewProps,
|
|
5
|
-
AndroidWebViewProps,
|
|
6
|
-
WindowsWebViewProps,
|
|
7
|
-
} from './WebViewTypes';
|
|
3
|
+
import { IOSWebViewProps, AndroidWebViewProps } from './WebViewTypes';
|
|
8
4
|
import styles from './WebView.styles';
|
|
9
5
|
|
|
10
|
-
export type WebViewProps = IOSWebViewProps &
|
|
11
|
-
AndroidWebViewProps &
|
|
12
|
-
WindowsWebViewProps;
|
|
6
|
+
export type WebViewProps = IOSWebViewProps & AndroidWebViewProps;
|
|
13
7
|
|
|
14
8
|
// This "dummy" WebView is to render something for unsupported platforms,
|
|
15
9
|
// like for example Expo SDK "web" platform.
|
package/src/WebViewShared.tsx
CHANGED
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
ShouldStartLoadRequestEvent,
|
|
7
7
|
WebViewError,
|
|
8
8
|
WebViewErrorEvent,
|
|
9
|
-
WebViewHttpErrorEvent,
|
|
10
9
|
WebViewMessage,
|
|
11
10
|
WebViewMessageEvent,
|
|
12
11
|
WebViewNavigation,
|
|
@@ -181,6 +180,8 @@ export {
|
|
|
181
180
|
createOnShouldStartLoadWithRequest,
|
|
182
181
|
defaultRenderLoading,
|
|
183
182
|
defaultRenderError,
|
|
183
|
+
passesWhitelist,
|
|
184
|
+
compileWhitelist,
|
|
184
185
|
};
|
|
185
186
|
|
|
186
187
|
export const useWebViewLogic = ({
|
|
@@ -192,7 +193,6 @@ export const useWebViewLogic = ({
|
|
|
192
193
|
onLoadEnd,
|
|
193
194
|
onError,
|
|
194
195
|
onLoadSubResourceError,
|
|
195
|
-
onHttpErrorProp,
|
|
196
196
|
onMessageProp,
|
|
197
197
|
onOpenWindowProp,
|
|
198
198
|
onRenderProcessGoneProp,
|
|
@@ -212,7 +212,6 @@ export const useWebViewLogic = ({
|
|
|
212
212
|
onLoadEnd?: (event: WebViewNavigationEvent | WebViewErrorEvent) => void;
|
|
213
213
|
onError?: (event: WebViewErrorEvent) => void;
|
|
214
214
|
onLoadSubResourceError?: (event: WebViewErrorEvent) => void;
|
|
215
|
-
onHttpErrorProp?: (event: WebViewHttpErrorEvent) => void;
|
|
216
215
|
onMessageProp?: (event: WebViewMessage) => void;
|
|
217
216
|
onOpenWindowProp?: (event: WebViewOpenWindowEvent) => void;
|
|
218
217
|
onRenderProcessGoneProp?: (event: WebViewRenderProcessGoneEvent) => void;
|
|
@@ -301,13 +300,6 @@ export const useWebViewLogic = ({
|
|
|
301
300
|
[onLoadSubResourceError]
|
|
302
301
|
);
|
|
303
302
|
|
|
304
|
-
const onHttpError = useCallback(
|
|
305
|
-
(event: WebViewHttpErrorEvent) => {
|
|
306
|
-
onHttpErrorProp?.(event);
|
|
307
|
-
},
|
|
308
|
-
[onHttpErrorProp]
|
|
309
|
-
);
|
|
310
|
-
|
|
311
303
|
// Android Only
|
|
312
304
|
const onRenderProcessGone = useCallback(
|
|
313
305
|
(event: WebViewRenderProcessGoneEvent) => {
|
|
@@ -409,7 +401,6 @@ export const useWebViewLogic = ({
|
|
|
409
401
|
onLoadingError,
|
|
410
402
|
onLoadingSubResourceError,
|
|
411
403
|
onLoadingFinish,
|
|
412
|
-
onHttpError,
|
|
413
404
|
onRenderProcessGone,
|
|
414
405
|
onContentProcessDidTerminate,
|
|
415
406
|
onMessage,
|