199 lines
8.9 KiB
React
199 lines
8.9 KiB
React
// Metro module 6760 (f6761).
|
|
import { useCallback, useEffect, useImperativeHandle, useMemo, useRef, forwardRef } from "react";
|
|
import { NativeModules, View, Image } from "react-native";
|
|
import { jsx } from "react/jsx-runtime";
|
|
import codegenNativeCommands from "./codegenNativeCommands";
|
|
import { defaultOriginWhitelist, useWebWiewLogic, defaultRenderLoading, defaultRenderError } from "./originWhitelistToRegex";
|
|
import Module39 from "./Module39";
|
|
import Module38 from "./Module38";
|
|
import Module6763 from "./Module6763";
|
|
import Module6764 from "./Module6764";
|
|
let c4344_13, resolveAssetSource, c4344_15;
|
|
const Image2 = Image;
|
|
let c4344_12 = (this ? this.__rest : this) || function(a0, a1) {
|
|
const r5 = {};
|
|
for (const key in a0) {
|
|
if (Object.prototype.hasOwnProperty.call(a0, key) && a1.indexOf(key) < 0) {
|
|
r5[key] = a0[key];
|
|
}
|
|
}
|
|
if (a0 != null && typeof Object.getOwnPropertySymbols === "function") {
|
|
const ownPropertySymbols = Object.getOwnPropertySymbols(a0);
|
|
const r27 = 0 < ownPropertySymbols.length;
|
|
let r29 = 0;
|
|
if (r27) {
|
|
do {
|
|
let r33 = a1.indexOf(ownPropertySymbols[r29]) < 0;
|
|
const r1 = r29;
|
|
if (r33) {
|
|
r33 = Object.prototype.propertyIsEnumerable.call(a0, ownPropertySymbols[r1]);
|
|
}
|
|
if (r33) {
|
|
r5[ownPropertySymbols[r1]] = a0[ownPropertySymbols[r1]];
|
|
}
|
|
r29 = r1 + 1;
|
|
} while (r29 < ownPropertySymbols.length);
|
|
}
|
|
}
|
|
return r5;
|
|
};
|
|
c4344_13 = codegenNativeCommands({
|
|
supportedCommands: ["goBack", "goForward", "reload", "stopLoading", "injectJavaScript", "requestFocus", "postMessage", "clearFormData", "clearCache", "clearHistory", "loadUrl"]
|
|
});
|
|
resolveAssetSource = Image2.resolveAssetSource;
|
|
c4344_15 = 0;
|
|
export default Object.assign(forwardRef(function(a0, a1) {
|
|
let r111;
|
|
const { overScrollMode: overScrollMode2 = "always", javaScriptEnabled: javaScriptEnabled2 = true, thirdPartyCookiesEnabled: thirdPartyCookiesEnabled2 = true, scalesPageToFit: scalesPageToFit2 = true, allowsFullscreenVideo: allowsFullscreenVideo2 = false, allowFileAccess: allowFileAccess2 = false, saveFormDataDisabled: saveFormDataDisabled2 = false, cacheEnabled: cacheEnabled2 = true, androidHardwareAccelerationDisabled: androidHardwareAccelerationDisabled2 = false, androidLayerType: androidLayerType2 = "none", originWhitelist = defaultOriginWhitelist, setSupportMultipleWindows: setSupportMultipleWindows2 = true, setBuiltInZoomControls: setBuiltInZoomControls2 = true, setDisplayZoomControls: setDisplayZoomControls2 = false, nestedScrollEnabled: nestedScrollEnabled2 = false } = a0;
|
|
let onShouldStartLoadWithRequest, onMessage, setViewState, memo;
|
|
const { startInLoadingState, messagingWithWebViewKeyEnabled, onNavigationStateChange, onLoadStart, onError, onLoad, onLoadEnd, onLoadProgress, onHttpError, onRenderProcessGone, onMessage: onMessage2 } = a0;
|
|
let renderLoading = a0.renderLoading;
|
|
let renderError = a0.renderError;
|
|
const { style, containerStyle, source, nativeConfig, onShouldStartLoadWithRequest: onShouldStartLoadWithRequest2 } = a0;
|
|
const r37 = c4344_12(a0, ["overScrollMode", "javaScriptEnabled", "thirdPartyCookiesEnabled", "scalesPageToFit", "allowsFullscreenVideo", "allowFileAccess", "saveFormDataDisabled", "cacheEnabled", "androidHardwareAccelerationDisabled", "androidLayerType", "originWhitelist", "setSupportMultipleWindows", "setBuiltInZoomControls", "setDisplayZoomControls", "nestedScrollEnabled", "startInLoadingState", "messagingWithWebViewKeyEnabled", "onNavigationStateChange", "onLoadStart", "onError", "onLoad", "onLoadEnd", "onLoadProgress", "onHttpError", "onRenderProcessGone", "onMessage", "renderLoading", "renderError", "style", "containerStyle", "source", "nativeConfig", "onShouldStartLoadWithRequest"]);
|
|
const concat = "WebViewMessageHandler".concat;
|
|
const r73 = c4344_15 + 1;
|
|
c4344_15 = r73;
|
|
const current = useRef(concat.call("WebViewMessageHandler", r73)).current;
|
|
const ref = useRef(null);
|
|
const webWiewLogic = useWebWiewLogic({
|
|
onNavigationStateChange,
|
|
onLoad,
|
|
onError,
|
|
onHttpErrorProp: onHttpError,
|
|
onLoadEnd,
|
|
onLoadProgress,
|
|
onLoadStart,
|
|
onRenderProcessGoneProp: onRenderProcessGone,
|
|
onMessageProp: onMessage2,
|
|
startInLoadingState,
|
|
originWhitelist,
|
|
onShouldStartLoadWithRequestProp: onShouldStartLoadWithRequest2,
|
|
onShouldStartLoadWithRequestCallback: useCallback(function(a0, a1, a2) {
|
|
if (a2) {
|
|
NativeModules.RNCWebView.onShouldStartLoadWithRequestCallback(a0, a2);
|
|
} else if (a0) {
|
|
c4344_13.loadUrl(ref.current, a1);
|
|
}
|
|
}, [])
|
|
});
|
|
const onLoadingStart = webWiewLogic.onLoadingStart;
|
|
onShouldStartLoadWithRequest = webWiewLogic.onShouldStartLoadWithRequest;
|
|
onMessage = webWiewLogic.onMessage;
|
|
const viewState = webWiewLogic.viewState;
|
|
setViewState = webWiewLogic.setViewState;
|
|
const { lastErrorEvent, onHttpError: onHttpError2, onLoadingError, onLoadingFinish, onLoadingProgress, onRenderProcessGone: onRenderProcessGone2 } = webWiewLogic;
|
|
useImperativeHandle(a1, function() {
|
|
return {
|
|
goForward: function goForward() {
|
|
return c4344_13.goForward(ref.current);
|
|
},
|
|
goBack: function goBack() {
|
|
return c4344_13.goBack(ref.current);
|
|
},
|
|
reload: function reload() {
|
|
setViewState("LOADING");
|
|
c4344_13.reload(ref.current);
|
|
},
|
|
stopLoading: function stopLoading() {
|
|
return c4344_13.stopLoading(ref.current);
|
|
},
|
|
postMessage: function postMessage(a0) {
|
|
return c4344_13.postMessage(ref.current, a0);
|
|
},
|
|
injectJavaScript: function injectJavaScript(a0) {
|
|
return c4344_13.injectJavaScript(ref.current, a0);
|
|
},
|
|
requestFocus: function requestFocus() {
|
|
return c4344_13.requestFocus(ref.current);
|
|
},
|
|
clearFormData: function clearFormData() {
|
|
return c4344_13.clearFormData(ref.current);
|
|
},
|
|
clearCache: function clearCache(a0) {
|
|
return c4344_13.clearCache(ref.current, a0);
|
|
},
|
|
clearHistory: function clearHistory() {
|
|
return c4344_13.clearHistory(ref.current);
|
|
}
|
|
};
|
|
}, [setViewState, ref]);
|
|
memo = useMemo(function() {
|
|
return {
|
|
onShouldStartLoadWithRequest,
|
|
onMessage
|
|
};
|
|
}, [onMessage, onShouldStartLoadWithRequest]);
|
|
useEffect(function() {
|
|
Module39.registerCallableModule(current, memo);
|
|
}, [current, memo]);
|
|
if (viewState === "LOADING") {
|
|
if (!renderLoading) {
|
|
renderLoading = defaultRenderLoading;
|
|
}
|
|
r111 = renderLoading();
|
|
} else if (viewState === "ERROR") {
|
|
Module38(lastErrorEvent != null, "lastErrorEvent expected to be non-null");
|
|
if (!renderError) {
|
|
renderError = defaultRenderError;
|
|
}
|
|
r111 = renderError(lastErrorEvent.domain, lastErrorEvent.code, lastErrorEvent.description);
|
|
} else {
|
|
r111 = null;
|
|
if (viewState !== "IDLE") {
|
|
console.error("RNCWebView invalid state encountered: ".concat(viewState));
|
|
r111 = null;
|
|
}
|
|
}
|
|
const style2 = [Module6763.container, Module6763.webView, style];
|
|
const style3 = [Module6763.container, containerStyle];
|
|
const r143 = (typeof source !== "number" ? source : typeof source !== "number") && "method" in source;
|
|
L52: {
|
|
if (r143) {
|
|
if (source.method === "POST" && source.headers) {
|
|
console.warn("WebView: `source.headers` is not supported when using POST.");
|
|
break L52;
|
|
}
|
|
if (source.method === "GET" && source.body) {
|
|
console.warn("WebView: `source.body` is not supported when using GET.");
|
|
}
|
|
}
|
|
}
|
|
return <View style={style3}>
|
|
{jsx(nativeConfig?.component || Module6764, {
|
|
...r37,
|
|
messagingEnabled: typeof onMessage2 !== "function" ? messagingWithWebViewKeyEnabled != null && messagingWithWebViewKeyEnabled : typeof onMessage2 === "function",
|
|
messagingModuleName: current,
|
|
onLoadingError,
|
|
onLoadingFinish,
|
|
onLoadingProgress,
|
|
onLoadingStart,
|
|
onHttpError: onHttpError2,
|
|
onRenderProcessGone: onRenderProcessGone2,
|
|
onMessage,
|
|
onShouldStartLoadWithRequest,
|
|
ref,
|
|
source: resolveAssetSource(source),
|
|
style: style2,
|
|
overScrollMode: overScrollMode2,
|
|
javaScriptEnabled: javaScriptEnabled2,
|
|
thirdPartyCookiesEnabled: thirdPartyCookiesEnabled2,
|
|
scalesPageToFit: scalesPageToFit2,
|
|
allowsFullscreenVideo: allowsFullscreenVideo2,
|
|
allowFileAccess: allowFileAccess2,
|
|
saveFormDataDisabled: saveFormDataDisabled2,
|
|
cacheEnabled: cacheEnabled2,
|
|
androidHardwareAccelerationDisabled: androidHardwareAccelerationDisabled2,
|
|
androidLayerType: androidLayerType2,
|
|
setSupportMultipleWindows: setSupportMultipleWindows2,
|
|
setBuiltInZoomControls: setBuiltInZoomControls2,
|
|
setDisplayZoomControls: setDisplayZoomControls2,
|
|
nestedScrollEnabled: nestedScrollEnabled2,
|
|
...nativeConfig?.props
|
|
}, "webViewKey")}
|
|
{r111}
|
|
</View>;
|
|
}), {
|
|
isFileUploadSupported: NativeModules.RNCWebView.isFileUploadSupported()
|
|
});
|